gpt4 book ai didi

ios - 在 imagePickerController IOS 7 中以编程方式删除状态栏

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:44:09 26 4
gpt4 key购买 nike

我需要在拍照时删除状态栏,你试试这个但是不行

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

- (IBAction)botonCamara:(id)sender {


// Make sure camera is available
if ([UIImagePickerController
isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == NO)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Camera Unavailable"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil, nil];
[alert show];
return;
}
if (imagePicker == nil)
{
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.allowsEditing = YES;
}
[self presentViewController:imagePicker animated:YES completion:NULL];

}

#pragma mark - delegate methods

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{

UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
UIImageWriteToSavedPhotosAlbum (image, nil, nil , nil);

[self dismissViewControllerAnimated:YES completion:NULL];
}

最佳答案

如果你想完全隐藏状态栏就这样做

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.

if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
}

// Add this Method
- (BOOL)prefersStatusBarHidden
{
return YES;
}

关于ios - 在 imagePickerController IOS 7 中以编程方式删除状态栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21413294/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com