Ios 上传图像时隐藏状态栏
当我将图像从相机上传到imageview时,图像上传成功,但我的状态栏变为隐藏。我在iOS上比较新。请帮忙。任何我正在应用程序中设置的代理。他们隐藏了我的状态栏。任何帮助都会得到安抚Ios 上传图像时隐藏状态栏,ios,objective-c,iphone,uiimagepickercontroller,Ios,Objective C,Iphone,Uiimagepickercontroller,当我将图像从相机上传到imageview时,图像上传成功,但我的状态栏变为隐藏。我在iOS上比较新。请帮忙。任何我正在应用程序中设置的代理。他们隐藏了我的状态栏。任何帮助都会得到安抚 [application setStatusBarStyle:UIStatusBarStyleLightContent]; [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO]; and i m
[application setStatusBarStyle:UIStatusBarStyleLightContent];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
and i m setting in info.plist
View controller-based status bar appearance NO
-(IBAction)choosePicture:(id)sender
{
imagePicker=[[UIImagePickerController alloc]init];
imagePicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate=self;
[self presentViewController:imagePicker animated:YES completion:nil];
}
-(IBAction)takePicture:(id)sender
{
imagePicker=[[UIImagePickerController alloc]init];
imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
[self presentViewController:imagePicker animated:YES completion:nil];
}
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
pickedImage=[info objectForKey:UIImagePickerControllerOriginalImage];
[self performSelectorInBackground:@selector(saveImage:) withObject:nil];
image.image=pickedImage;
pickedImage = [self compressImage:pickedImage];
pickedImageData=UIImageJPEGRepresentation(pickedImage,0.9);
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
-(BOOL)prefersStatusBarHidden // also do this for iOS 8
{
return YES;
}
不确定您正在使用哪个iOS版本。我在iOS 8.3中体验到了这一点,这就是我如何解决它的,在您的viewWillExample方法中:
- (void)viewWillAppear:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarHidden:NO];
}
添加上述代码以查看问题是否已解决。您的问题是以下代码:
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
当导航弹出或按下、显示或关闭viewcontroller时,将调用此函数。如果你应该这样检查
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
if ([viewController isKindOfClass:[UIImagePickerViewController class]])
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
else
{
[[UIApplication sharedApplication] setStatusBarHidden:NO];
}
}
请添加您的代码。。不管你现在做了什么。