Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

iphone - iOS SDK - How to get the status bar back when using UIImagePickerController?

As soon as I add a UIImagePickerController sub view to my view the status bar disappears and I can't get it back. Is there any way to keep the status bar visible?

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;


[self.view addSubview:imagePicker.view];

[imagePicker viewWillAppear:YES];
[imagePicker viewDidAppear:YES];

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had to do the same thing in a camera app as well. Apparently, in addition to setting the status bar to not be hidden, you also have to reset its style after the camera view makes it disappear. Try this:

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...