在 io7 中,视图顶部的状态栏是一场噩梦。幸运的是,我设法让它工作,所以它将被放置在视图上方。我是这样做的:
- (void)viewDidLoad
{
[super viewDidLoad];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
self.view.backgroundColor=[UIColor colorWithRed:(152/255.0) green:(204/255.0) blue:(51/255.0) alpha:1] ;
CGRect frame = self.topNav.frame; frame.origin.y = 20;
self.topNav.frame = frame;
}
....
}
现在我的状态栏在我的导航栏上方。
但是调用UIImagePickerController
的时候就不一样了。上面的代码没有任何作用。我试图这样做:
- (void)showImagePickerForSourceType:(UIImagePickerControllerSourceType)sourceType
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
CGRect frame = self.imagePickerController.frame; frame.origin.y = 20;
self.imagePickerController.frame = frame;
}
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = sourceType;
imagePickerController.delegate = self;
self.imagePickerController = imagePickerController;
self.imagePickerController.allowsEditing=YES;
....
}
结果是:
相机上方的状态栏(显示相机拍照时)是否有机会控制?
谢谢你。