添加UIImagePickerController时不显示状态栏

时间:2010-09-27 05:03:24

标签: cocoa-touch uikit

我想在导航栏和&之间显示一个Camera视图。标签栏,所以我添加了UIImagePickerController对象,如下所示。

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];

请注意,Camera3DViewControllerUIImagePickerController Class的子类。

相机显示但状态栏未显示,所以我使用

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];

但仍然没有显示状态栏。

请指导我解决上述问题。

1 个答案:

答案 0 :(得分:3)

我将UIImagePictureController子类化并添加:

- (void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated]; 

    [[UIApplication sharedApplication] setStatusBarHidden:NO animated:animated];
}

在[super viewDidAppear:animated]之后显示状态非常重要;打电话,否则它没有出现。调用超类方法也很重要。