UIPickerView不在actionSheet中滚动

时间:2011-05-23 13:59:02

标签: ios uipickerview uiactionsheet

我在UIActionSheet中添加了一个UIPickerView。一切都好,但我的选择器无法滚动选择值。有什么建议吗?

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
UIPickerView * picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 50, 320, 270)]; 
picker.showsSelectionIndicator = YES;
picker.dataSource = self;
picker.delegate = self;
[actionSheet addSubview:picker];
[picker release];

[actionSheet showInView:self.view];
[actionSheet setBounds:CGRectMake(0, 0, 320, 500)];
[actionSheet release];

祝你好运, 多兰基尔托

1 个答案:

答案 0 :(得分:0)

您尝试实现的目标的另一种解决方案是设置文本字段inputViewinputAccessoryView。设置这些将替换标准键盘并引入自定义视图。这包括选择器视图。我碰巧在这里写了一个简短的例子question。看看它是否有帮助。