在我的應用程序中,當我點擊更改圖像時,它會詢問UIActionsheet有三個操作拍照,選擇圖庫並取消。拍照,從圖庫中選擇顯示但取消不顯示問題出在哪裏。 這是我的代碼在UIActionSheet取消按鈕不顯示iPhone?
- (void)viewDidLoad
{
[super viewDidLoad];
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select Image from..."
delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Take Photo", @"Choose from library", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:self.view];
}
你有一次'{'兩次,'}'。 – Daniel
這段代碼不是問題。我創建了一個新項目,並使用了你的代碼(只有一個'''')。它按預期工作。我得到一個帶有3個按鈕的操作表:「拍照」和「從庫中選擇」爲淺灰色,以及「取消」按鈕,深灰色,標題爲「Select Image from ...」 – Daniel
您是否在應用中使用了tabBar ? – Apple