当我按下一个字段时,我必须从下拉菜单中选择一个类别....而不使用选择器视图...
答案 0 :(得分:3)
您可以尝试使用这样的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;
}
}
答案 1 :(得分:0)
你必须推出自己的一个。我在这种情况下所做的是将一个选择器视图移出屏幕,然后当他们点击按钮时,它会将选择器视图的移动动画到屏幕上。然后当他们选择时它就会消失。