我正在开发通用应用程序。我已经实现了图像选择器和代码,如下所示。
isimagepiking=TRUE;
imgPicker = [[UIImagePickerController alloc] init];
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
NSArray *mediaTypesAllowed = [NSArray arrayWithObject:@"public.image"];
[imgPicker setMediaTypes:mediaTypesAllowed];
imgPicker.delegate = self;
imgPicker.allowsEditing = YES;
imgPicker.wantsFullScreenLayout=true;
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone)
{
[self presentViewController:imgPicker animated:YES completion:nil];
}
Bellow code print 480 作为尺寸。
NSLog(@"%f",imgPicker.view.frame.size.height);
这款iphone 5 + ios 8.3以及ios 7.1以下iphone 4的功能正常,但 iphone 4s ios 8 + 选择器不显示< strong>选择和取消按钮
使用ios 7.1 iphone 4s进行屏幕显示。
使用iOS 8.2 iPhone 4s的屏幕 - 未显示选择或取消按钮
似乎在iOS 8+中它的uiscreen尺寸为4英寸。 任何人都可以帮助我。
先谢谢
答案 0 :(得分:0)
我希望提出观点正在解决问题。试试addSubview
isimagepiking=TRUE;
imgPicker = [[UIImagePickerController alloc] init];
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
NSArray *mediaTypesAllowed = [NSArray arrayWithObject:@"public.image"];
[imgPicker setMediaTypes:mediaTypesAllowed];
imgPicker.delegate = self;
imgPicker.allowsEditing = YES;
imgPicker.wantsFullScreenLayout=true;
// Try Adding imagepicker as a subview
[self createAnimationsinView:self.view];
[self.view addSubview:imgPicker.view] ;
如果您想要一个当前的视图控制器动画,也可以这样做。
//呈现视图控制器动画
-(void)createAnimationsinView:(UIView*)view{
CATransition* transition = [CATransition animation];
transition.duration = 0.5;
transition.type = kCATransitionMoveIn;
transition.subtype =kCATransitionFromTop;
[view.window.layer addAnimation:transition forKey:kCATransition];
}