Status Bar doesnot display when adding UIImagePickerController
I want to show a Camera view in between Navigation bar & Tab bar, so I added the UIImagePickerController
object as follows.
picker = [[Camera3DViewController alloc] init];
picker.allowsImageEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls = NO;
picker.view.transform = CGAffineTransformScale(picker.view.transform, 1, 1);
[self.view addSubview:picker.view];
[picker viewWillAppear:YES];
[picker viewDidAppear:YES];
Note that Camera3DViewController
is a su开发者_JS百科bclass of UIImagePickerController
Class.
Camera get display but status bar does not shown, so I use,
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
but still it does not show the status bar.
Please guide me to solve the above problem.
I subclassed UIImagePictureController and added:
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:animated];
}
It is important to show status after [super viewDidAppear:animated]; call, else it didn't appear. Also it is important to call superclass method.
精彩评论