ios - The view is “jumping” when I add it to UIWindow as subview (via rootViewController property) and do a flip -


i have 2 simple uiviewcontrollers, views 320 x 460 status bars. in appdelegate

self.window.rootviewcontroller = [[[simplecontroller alloc] init] autorelease];  [self.window makekeyandvisible]; 

in simplecontroller have button does

- (ibaction) switchtoverysimplecontroller {   [uiview transitionwithview: [[uiapplication sharedapplication] keywindow]                     duration: 0.5                      options: uiviewanimationoptiontransitionflipfromleft                   animations:^{ [[uiapplication sharedapplication] keywindow].rootviewcontroller = [[[verysimplecontroller alloc] init] autorelease]; }                   completion: null]; } 

the new view (verysimplecontroller.view) filled blue color. after animation new view shown tiny white stripe (with size of status bar) @ bottom , jumps down place. why happening , how avoid that? suppose status bar blame, , tried set statusbar = unspecified in ib both views, doesn't help.

update: when hide statusbar (thru setting in .info file) start, no view adjustment occurs. still... need show statusbar , need animation working properly.

when rootviewcontroller assigned window, a new frame assigned rootviewcontroller's view if status bar present. rootviewcontroller's view won't hidden under status bar.

since you're setting window's rootviewcontroller inside animation block, new frame assignment gets animated well.

to not show jump might set frame of rootviewcontroller's view before animation this:

- (ibaction) switchtoverysimplecontroller {     cgrect statusbarframe = [[uiapplication sharedapplication] statusbarframe];      verysimplecontroller *vsc = [[[verysimplecontroller alloc] init] autorelease];      vsc.view.frame = cgrectmake(vsc.frame.origin.x,                      statusbarframe.size.height,                      vsc.frame.size.width,                      vsc.frame.size.height);      [uiview transitionwithview: [[uiapplication sharedapplication] keywindow]                       duration: 0.5                        options: uiviewanimationoptiontransitionflipfromleft                     animations:^{ [[uiapplication sharedapplication] keywindow].rootviewcontroller = vsc }                     completion: null]; } 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -