3

我想使用 UIActionSheet 允许用户选择我的 iphone 应用程序的两种模式之一。所以我不需要显示取消按钮。我只是想问他是否要选择模式一或二。我试图不添加它,但它不允许我,我该怎么做?

注意:我不想使用警报。

我使用此代码添加 UIActionSheet:

UIActionSheet *mySheet = [[UIActionSheet alloc] initWithTitle:@"choose one" delegate:nil cancelButtonTitle:@"tasks" destructiveButtonTitle:@"appointments" otherButtonTitles:nil];


[mySheet showInView:self.view];
4

1 回答 1

6

尝试:

UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"Share" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Mode 1",@"Mode 2", nil];
[actionSheet showInView:self.view];

只需设置cancelButtonTitlenil

于 2013-08-16T23:19:14.553 回答