问题描述
我已将UIPickerView添加到UIActionSheet中。一切正常,但我的选择器无法滚动以选择一个值。有什么建议么?
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,500)];
[actionSheet release];
最好的祝福,
多林
解决方法
您尝试实现的另一种解决方案是设置文本字段的
inputView
和inputAccessoryView
。设置这些将替换标准键盘并带来自定义视图。这包括选择器视图。我碰巧在这个问题上写了一个简短的例子。看看是否有帮助。