繁体   English   中英

适用于iPhone 4s的iOS 8+中的UIImagePickerController屏幕问题

[英]UIImagePickerController screen issue in iOS 8+ for iPhone 4s

我正在研究通用应用程序。 我已经实现了图像选择器,并且代码如下。

 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];
}

波纹管代码打印为480

 NSLog(@"%f",imgPicker.view.frame.size.height);

在装有ios 8.3的iphone 5+和低于ios 7.1的iphone 4中,此功能正常工作,但是在ios 8+选取器的iphone 4s中 ,没有显示“选择取消”按钮

装有ios 7.1 iphone 4s的屏幕。 iOS 7.1 iPhone 4s屏幕-正常工作

装有iOS 8.2 iPhone 4s的屏幕-不显示选择取消按钮 装有iOS 8.2 iPhone 4s的屏幕-无法正常工作

似乎在iOS 8+中,uiscreen尺寸为4英寸。 谁能帮我这个忙。

提前致谢

我希望提出观点能够解决问题。 尝试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];
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM