如何在iOS应用程序中按下按钮时显示按钮列表
我不知道该搜索什么或它叫什么,因为我是全新的。请帮助我,当我按下按钮时,它将显示其他按钮。我们在很多应用程序中都找到了它,但我不知道它的名字。。我把它的照片附在下面。如何在iOS应用程序中执行此操作 被调用 下面是一个复杂的评分员示例:如何在iOS应用程序中按下按钮时显示按钮列表,ios,button,Ios,Button,我不知道该搜索什么或它叫什么,因为我是全新的。请帮助我,当我按下按钮时,它将显示其他按钮。我们在很多应用程序中都找到了它,但我不知道它的名字。。我把它的照片附在下面。如何在iOS应用程序中执行此操作 被调用 下面是一个复杂的评分员示例: UIActionSheet *actionSheet = [[UIActionSheet alloc] init] ; actionSheet.title = @"Change pincode?"; actionSheet.delegat
UIActionSheet *actionSheet = [[UIActionSheet alloc] init] ;
actionSheet.title = @"Change pincode?";
actionSheet.delegate = self;
actionSheet.tag = kChangePincode;
[actionSheet addButtonWithTitle:@"Chacge pincode"];
[actionSheet addButtonWithTitle:@"Remove pin code"];
[actionSheet addButtonWithTitle:@"cancel"];
[actionSheet setCancelButtonIndex:(actionSheet.numberOfButtons - 1)];
[actionSheet showInView:self.view];
通过
你喜欢这样吗
//h班
@interface MyViewController : UIViewController <UIActionSheetDelegate> {
...
}
...
-(IBAction)showActionSheet:(id)sender;
删除了对Xcode的提及,因为您的问题与IDE无关,而与iOS有关。这是一个
UIActionSheet
。如果你想开发iOS应用程序,我建议你开始阅读基本的阅读-和。谢谢你的代码。。。也可以从中得到帮助
-(IBAction)showActionSheet:(id)sender {
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Title" delegate:self cancelButtonTitle:@"Cancel Button" destructiveButtonTitle:@"Destructive Button" otherButtonTitles:@"Other Button 1", @"Other Button 2", nil];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupQuery showInView:self.view];
[popupQuery release];
}
// Handle Delegates-------------
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
self.label.text = @"Destructive Button Clicked";
} else if (buttonIndex == 1) {
self.label.text = @"Other Button 1 Clicked";
} else if (buttonIndex == 2) {
self.label.text = @"Other Button 2 Clicked";
} else if (buttonIndex == 3) {
self.label.text = @"Cancel Button Clicked";
}
/**
* OR use the following switch statement
*
*/
/*
switch (buttonIndex) {
case 0:
self.label.text = @"Destructive Button Clicked";
break;
case 1:
self.label.text = @"Other Button 1 Clicked";
break;
case 2:
self.label.text = @"Other Button 2 Clicked";
break;
case 3:
self.label.text = @"Cancel Button Clicked";
break;
}
*/
}