2011-08-22 65 views
0

我在我的iPhone应用程序的动作表中显示一个选择器视图;也就是说,我在视图中有一个按钮,它会触发一个包含选取器视图的操作表。除非用户旋转设备,否则它效果很好。当用户以横向模式显示视图,然后触摸动作表的按钮时,pickerview确实会出现,但它看起来挺起了头。另一方面,当用户以纵向模式加载视图,然后触摸提示动作表的按钮时,它看起来没问题。对这里可能发生的事情有任何想法? This is when the user opens the actionsheet from a view that's already in landscape modeUIPickerView在横向动作表中

This is how it looks when the user opens the view in portrait, and then turns the device to landscape

回答

3

确保您配置的动作片的边界和pickerview的框架,以适应您使用的方向。

我使用以下设置景观:

[self.sheet setBounds:CGRectMake(0, 0, 480, 400)]; 
CGRect pickerFrame = CGRectMake(0, 40, 480, 180); 
closeButton.frame = CGRectMake(420, 7.0f, 50.0f, 30.0f); 

而对于人像以下:

[sheet setBounds:CGRectMake(0, 0, 320, 500)]; 
CGRect pickerFrame = CGRectMake(0, 40, 0, 0); 
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f); 

祝你好运!

// Seto