ios - 在 imagePickerController IOS 7 中以编程方式删除状态栏
<p><p>我需要在拍照时删除状态栏你试试这个但不起作用</p>
<p><strong>[ setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];</strong></p>
<pre><code>- (IBAction)botonCamara:(id)sender {
// Make sure camera is available
if ([UIImagePickerController
isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == NO)
{
UIAlertView *alert = [ initWithTitle:@"Error"
message:@"Camera Unavailable"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil, nil];
;
return;
}
if (imagePicker == nil)
{
imagePicker = [ init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.allowsEditing = YES;
}
;
}
#pragma mark - delegate methods
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = ;
UIImageWriteToSavedPhotosAlbum (image, nil, nil , nil);
;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>如果您想完全隐藏状态栏,请执行此操作</p>
<pre><code>- (void)viewDidLoad
{
;
// Do any additional setup after loading the view from its nib.
if () {
// iOS 7
;
;
} else {
// iOS 6
[ setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
}
// Add this Method
- (BOOL)prefersStatusBarHidden
{
return YES;
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 在 imagePickerController IOS 7 中以编程方式删除状态栏,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/21413294/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/21413294/
</a>
</p>
页:
[1]