我想使用UIActionSheet允许用户选择我的iPhone应用程序的两种模式之一.所以我不需要显示取消按钮.我只想问他是否想选择一两种模式.我试着不添加它,但它不允许我这样我怎么能这样做?
注意:我不想使用警报.
我使用此代码添加UIActionSheet:
UIActionSheet *mySheet = [[UIActionSheet alloc] initWithTitle:@"choose one" delegate:nil cancelButtonTitle:@"tasks" destructiveButtonTitle:@"appointments" otherButtonTitles:nil];
[mySheet showInView:self.view];
Run Code Online (Sandbox Code Playgroud)
尝试:
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Share" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Mode 1",@"Mode 2", nil];
[actionSheet showInView:self.view];
Run Code Online (Sandbox Code Playgroud)
只需设置cancelButtonTitle为nil