1
我不得不从下拉菜单中选择一个类别,当我按字段....不使用选择器视图...如何实现下拉菜单
我不得不从下拉菜单中选择一个类别,当我按字段....不使用选择器视图...如何实现下拉菜单
你将不得不滚动你自己的一个。我在这种情况下做的是将选取器视图移出屏幕,然后当它们按下按钮时,它将选取器视图移动到屏幕上。然后它们在选中时熄灭。
你可以尝试使用UIActionSheet这样的:
UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"A title here" delegate:self
cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Dismiss"
otherButtonTitles:@"One option", @"Another option", nil];
[action showInView:self.view];
然后实现委托方法像这样的:
// Called when a button is clicked. The view will be automatically dismissed after this call returns
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (buttonIndex) {
case x:
//Chose option x
break;
...
default:
//Default action
break;
}
}