uiview - Unable to hide status bar on iOS 6,7 when presenting viewcontroller -


the following custom vc presentation code:

-(void)presentviewcontroller:(uiviewcontroller*)vc {     uiwindow *w = [[[uiapplication sharedapplication] delegate] window];     uiviewcontroller *parentcontroller = (tabbarviewcontroller *)[w rootviewcontroller];      [parentcontroller addchildviewcontroller:vc];     if ([vc respondstoselector:@selector(beginappearancetransition:animated:)]) // ios 6     {         [vc beginappearancetransition:yes animated:yes];     }     uiview *toview = vc.view;     [parentcontroller.view addsubview:toview];     toview.frame = parentcontroller.view.bounds;      cgaffinetransform tr = cgaffinetransformscale(self.view.transform, 1.0f, 1.0f);     toview.transform = cgaffinetransformscale(self.view.transform, 0.01f, 0.01f);;     cgpoint oldcenter = toview.center;      toview.center = ((rootviewcontrollerex*)vc).cellcenter;      [uiview animatewithduration:4.5 animations:^{             toview.transform = tr;             toview.center = oldcenter;     } completion:^(bool finished) {          [vc didmovetoparentviewcontroller:parentcontroller];         if ([vc respondstoselector:@selector(endappearancetransition)]) // ios 6         {             [vc endappearancetransition];         }      }]; } 

it works fine, however, in presented vc hiding status bar:

- (bool)prefersstatusbarhidden {     return yes; } 

when present vc using built-in presentviewcontroller:animated:completion:, status bar in presented vc hidden. code on ios 7 status bar not hidden @ all, on ios 6 more strange - status bar hidden, view size shorter top size of status bar. can see black gap top on ios 6. should hide status bar when using custom vc presentation?

you should try in viewdidload differencing ios 6/7 status bar problem

 if ([self respondstoselector:@selector(setneedsstatusbarappearanceupdate)]) {     //ios 7 - status bar hidden     [self prefersstatusbarhidden];     [self performselector:@selector(setneedsstatusbarappearanceupdate)];     self.statusbarhidden = yes; } else {     // ios 6 - status bar shown     [[uiapplication sharedapplication] setstatusbarhidden:no withanimation:uistatusbaranimationslide];     self.statusbarhidden = no; } 

and method hiding status bar

 - (bool)prefersstatusbarhidden{ return yes;} 

and add property status bar

@property bool statusbarhidden; 

then make sure view bounds screen size , fits correctly

i think solves problem :)


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -