ios7 - "presented view controller always full screen" not true for iOS 7 custom transitioning? -


apple documentation (https://developer.apple.com/library/ios/documentation/uikit/reference/uiviewcontroller_class/reference/reference.html#//apple_ref/occ/instm/uiviewcontroller/presentviewcontroller:animated:completion:) says "on iphone , ipod touch, presented view full screen." in ios 7, there custom view controller transitioning api. there many demos show "presentedviewcontroller" can size want. apple's doc not true in case ?

i believe apple still correct although perhaps misleading. presented full screen default, if provide custom transition delegate can whatever want frame, etc...

what apple means full screen (in context, think), it's edges extend device's height & width maximums. restricted things navbar or other toolbars may have been added, default in ios 7 don't respect them more.

however custom transition, can have smaller view controller overlay view controller changing size of it's frame during transition. see teehan & lax's awesome transition api post here example:

http://www.teehanlax.com/blog/custom-uiviewcontroller-transitions/

here's -animatetransition method setting frame on to view controller value that's not going full screen. note lines endframe variable set up:

- (void)animatetransition:(id <uiviewcontrollercontexttransitioning>)transitioncontext {     // grab , view controllers context     uiviewcontroller *fromviewcontroller = [transitioncontext viewcontrollerforkey:uitransitioncontextfromviewcontrollerkey];     uiviewcontroller *toviewcontroller = [transitioncontext viewcontrollerforkey:uitransitioncontexttoviewcontrollerkey];      // set our ending frame. we'll modify later if have     cgrect endframe = cgrectmake(80, 280, 160, 100);   // <- frame 160 x 100      if (self.presenting) {         fromviewcontroller.view.userinteractionenabled = no;          [transitioncontext.containerview addsubview:fromviewcontroller.view];         [transitioncontext.containerview addsubview:toviewcontroller.view];          cgrect startframe = endframe;         startframe.origin.x += 320;          toviewcontroller.view.frame = startframe;          [uiview animatewithduration:[self transitionduration:transitioncontext] animations:^{             fromviewcontroller.view.tintadjustmentmode = uiviewtintadjustmentmodedimmed;             toviewcontroller.view.frame = endframe;         } completion:^(bool finished) {             [transitioncontext completetransition:yes];         }];     }     else {         toviewcontroller.view.userinteractionenabled = yes;          [transitioncontext.containerview addsubview:toviewcontroller.view];         [transitioncontext.containerview addsubview:fromviewcontroller.view];          endframe.origin.x += 320;          [uiview animatewithduration:[self transitionduration:transitioncontext] animations:^{             toviewcontroller.view.tintadjustmentmode = uiviewtintadjustmentmodeautomatic;             fromviewcontroller.view.frame = endframe;         } completion:^(bool finished) {             [transitioncontext completetransition:yes];         }];     } } 

so, when providing custom transition view controller transition from , to have whichever edges and/or frames specify them. don't become full screen when begin custom transition, apple right, not thorough in it's explanation of present method's description.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -