编辑:我正在使用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
所示:
编辑:关闭时 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/