Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios iphone 6s及以上设备的UIPickerView宽度问题_Ios_Objective C_Iphone_Xcode_Uipickerview - Fatal编程技术网

Ios iphone 6s及以上设备的UIPickerView宽度问题

Ios iphone 6s及以上设备的UIPickerView宽度问题,ios,objective-c,iphone,xcode,uipickerview,Ios,Objective C,Iphone,Xcode,Uipickerview,iphone 6s模拟器中的UIPickerview宽度问题。在iPhone5S和6设备上运行良好,但pickerview width不适用于iPhone6S及以上设备模拟器 下面是我的代码和附加的屏幕截图 为什么要设置UIPickerView的框架?这里的rect与脚本/xib中配置的相同。最好使用自动布局并设置适当的约束。它将适用于任何屏幕: 检查此项: rect=CGRectMake(self.view.frame.origin.x,self.view.frame.origin.y-sel

iphone 6s模拟器中的UIPickerview宽度问题。在iPhone5S和6设备上运行良好,但pickerview width不适用于iPhone6S及以上设备模拟器

下面是我的代码和附加的屏幕截图


为什么要设置UIPickerView的框架?这里的
rect
与脚本/xib中配置的相同。最好使用自动布局并设置适当的约束。

它将适用于任何屏幕:

检查此项:

rect=CGRectMake(self.view.frame.origin.x,self.view.frame.origin.y-self.view.frame.size.width, self.view.frame.size.width, self.view.frame.size.height-self.view.frame.size.width);
并删除代码硬编码值

rect.origin.y = CGRectGetMaxY([UIScreen mainScreen].bounds)-320;
    rect.size.height = 330;

你是说60多岁?因为6s和6都有相同的宽度。你为什么不设置x???方向改变呢?你可以使用“UIInterfaceOrientation”将宽度的代码改为hight,hight改为width。。。。
rect.origin.y = CGRectGetMaxY([UIScreen mainScreen].bounds)-320;
    rect.size.height = 330;