ios - Popping UIViewController causes previous UIViewControllers View to change position -
i have uinavigationcontroller uiviewcontroller set it's rootcontroller, contains background on uiview using image set under navbar. push onto navigation controller new uiviewcontroller , when button pushed, previous controller looks different. using visual debugger can see self.view has moved entirely down below navbar @ top. have no idea , been racking brains why might happening
-(void)pushiphonemessagingcontactscontroller:(messagecontactsviewcontroller *)contactscontroller{ self.selectorview.hidden = yes; [self.navigationcontroller pushviewcontroller:contactscontroller animated:yes]; }
on rootviewcontroller (iphonemessagingnotificationscontroller)
-(void)viewwillappear:(bool)animated{ self.selectorview.hidden = no; [[[self navigationitem] leftbarbuttonitem] settintcolor:[uicolor blackcolor]]; [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstyledefault]; if ([_displaytype intvalue] == messages_showing) { [self.notificationsviewcontroller.view removefromsuperview]; [self.contentview addsubview:_messagesviewcontroller.view]; } else { [self.messagesviewcontroller.view removefromsuperview]; [self.contentview addsubview:_notificationsviewcontroller.view]; } }
it seems offending line in viewwillappear method of pushed uiviewcontroller
self.navigationcontroller.navigationbar.translucent = yes;
somewhere else navigationbar gets set translucent:
[self.navigationcontroller.navigationbar setbackgroundimage:[uiimage new] forbarmetrics:uibarmetricsdefault]; self.navigationcontroller.navigationbar.shadowimage = [uiimage new]; self.navigationcontroller.navigationbar.translucent = yes;
and make solid colour again:
self.navigationcontroller.navigationbar.shadowimage = nil; self.navigationcontroller.navigationbar.translucent = no;
but code seems mess layout perhaps there way change opacity of navbar , statusbar without affecting layout?
Comments
Post a Comment