uiviewcontroller - Supporting Multiple Interface but have single interface in home screen not working in iOS8 + iPhone -
i have view structure below.
homeview(support portrait mode) | | v view1(support orientation) | | v view2(support orientation)
problem :
when coming view2(landscape mode)
homeview
calling poptorootviewcontroller
method,it did not call supportedinterfaceorientationsforwindow
method of app_delegate , display homeview in landscape mode
.
image:
note :
same thing not happens when came view1(landscape mode) homeview calling poptorootviewcontroller method call supportedinterfaceorientationsforwindow , works great.
if run app using xcode6 in ios7 works great.
i read below question did not me
.
how maintain presenting view controller's orientation when dismissing modal view controller?
in above link matt
said ios8 stop support friezing orientation
, did not find in apple document
if have reference link
change please share.
question :
1] why delegate method supportedinterfaceorientationsforwindow not calling.
2] possible have 1 view support single orientation , other support orientation.
thanks
i solve , post answer may one
problem :
have below code in supportedinterfaceorientationsforwindow.
- (nsuinteger)application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window { // suport portrait mode home screen if([self.navigationcontroller.topviewcontroller iskindofclass:[viewhome class]]) { return uiinterfaceorientationmaskportrait; } return uiinterfaceorientationmaskall; }
but delegate
method supportedinterfaceorientationsforwindow
not called when use poptorootviewcontrolleranimated
method when there ismore 2 view cotnrollers
exists in stack.
solution :
step1: create sub class of navigation controller.
step2: override method poptorootviewcontrolleranimated , write code below // overwrite super class method poptorootviewcontrolleranimated.
-(nsarray*)poptorootviewcontrolleranimated:(bool)animated { // ios8 , above if (floor(nsfoundationversionnumber) > nsfoundationversionnumber_ios_7_1) { // array contaimn poped view controllers object. nsmutablearray *popedcontrollersarray = [[nsmutablearray alloc] init]; // tmp created controllers object nsarray *controllers; // hold first view cotnrollers. uiviewcontroller *firstviewcontroller = [self.viewcontrollers objectatindex:1]; // pop first view controllers no animation. controllers = [super poptoviewcontroller:firstviewcontroller animated:no]; // add poped view cotnrollers objects array. [popedcontrollersarray addobjectsfromarray:controllers]; // pop root view controller animation [super popviewcontrolleranimated:yes]; // add first view controller object poped above line. [popedcontrollersarray addobject:firstviewcontroller]; // return poped view controllers object. return popedcontrollersarray; } else { // called super view poptorootviewcontrolleranimated method , return popped // view controllers array. return [super poptorootviewcontrolleranimated:animated]; } }
please fill free comments , ask questions.
Comments
Post a Comment