开发者

Status Bar doesnot display when adding UIImagePickerController

开发者 https://www.devze.com 2023-01-18 04:33 出处:网络
I want to show a Camera view in between Navigation bar & Tab bar, so I added the UIImagePickerController object as follows.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消