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;
}
}