开发者

iPad UIPickerView causing problems

Can someone show me how I can get a UIPickerView working on the iPad? I'm trying to have a UIPickerView in the middle of the screen. Here is the current code I have:

if(IDIOM == IPAD)
    namePickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(200, 345, 400, 216)];
else
    namePickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 245, 0, 0)];

namePickerView.delegate = self;
namePickerView.showsSelectionIndicator = YES;

So this just puts the picker view on the far left. On the iPhone, everything is perfect. But on the iPad, this doesn't work. As soon as I try to scroll through the values, nothing movies. The UIPickerView does not respond to any touches. What is the issue here? I just want to put a UIPickerView of default size in the middle of my iPad screen, 345 pixels 开发者_JS百科down.


UIPickerViews on the ipad don't have a default size (ie width).

change

namePickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 345, 0, 0)];

to

namePickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 345, 400, 216)];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜