当我将图像从相机上传到我的imageview图像成功上传但我的状态栏变为隐藏。我是iOS的新手。请帮忙。 app appate中的任何设置。他们隐藏我的状态栏。任何帮助都会得到解决。
[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;
}
答案 0 :(得分:0)
不确定您所关注的iOS版本。我在iOS 8.3中遇到过这种情况,这就是我在viewWillAppear方法中解决它的方法:
- (void)viewWillAppear:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarHidden:NO];
}
添加上面的代码以查看问题是否已解决。
答案 1 :(得分:0)
你的问题是这段代码:
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
当导航弹出或推送,或显示或关闭视图控制器时,将调用此函数。如果应该像这样检查
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
if ([viewController isKindOfClass:[UIImagePickerViewController class]])
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
else
{
[[UIApplication sharedApplication] setStatusBarHidden:NO];
}
}