iphone - 仅在 iOS 6.0 中,UIImagePickerController 关闭时将 View 向上推至 20 px

标签 iphone ios objective-c uiimagepickercontroller

编辑:我正在使用UIStoryBoard

我已经呈现如下:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

imagePicker.delegate = self;

imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; //| UIImagePickerControllerSourceTypeSavedPhotosAlbum ;
imagePicker.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeImage,nil];

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
    {
        imagePicker.allowsEditing = YES;
        [self.navigationController presentViewController:imagePicker animated:YES completion:^{

        }];  
    }
}

现在被解雇

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
   UIImage *image = info[UIImagePickerControllerEditedImage];
    NSLog(@"Image : %@",image);
    [self dismissViewControllerAnimated:YES completion:^{
    }];
}

现在view变成这样,如fiqure所示:

enter image description here

编辑:关闭时 View 会被推至 20px。

编辑:这仅适用于 iOS 6.0

最佳答案

原因是我正在 View Controller 设置框架,该 Controller 处于protrait模式作为其上一个 View 处于横向模式

self.view.bounds = CGRectMake(0,0,...,...);

每当imagepicker dissmiss调用时,它移动原始位置提到

现在更改了结构方向无需在外部设置self.view框架解决了我的问题.

关于iphone - 仅在 iOS 6.0 中,UIImagePickerController 关闭时将 View 向上推至 20 px,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16705893/

相关文章:

ios - 苹果批准多个 Storyboard而不是尺寸类别?

iphone - 基于 JavaScript 的 iPhone UI 框架

ios - 在 Objective-C 中从 UIViewController 显示一个 SplitViewController

ios - 同一 iPad 应用程序的不同图标和标题

objective-c - Objective C NSString问题

iphone - 如何将系统毫秒转换为 objective-c 中的日期

iphone - 关于iPhone上URL中NSString字符无效的问题

ios - presentLocalNotificationNow 和 scheduleLocalNotification 的区别

iphone - 如何从外部框架加载资源

iOS 共享扩展未获取图像