[英]UIActionSheet cancel button not dismissing actionsheet
我有一個UIActionSheet,我正在指定取消按鈕但是當它點擊時它不會被忽略?
UIActionSheet *actionSheet = [[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Target Complete" otherButtonTitles:nil] autorelease];
[actionSheet showInView:self.view];
根據文檔,我不需要任何代碼,甚至當我嘗試實現didCancel委托方法時,它從未調用過?
這將成功
[actionSheet showInView:[self.view window]];
代替
[actionSheet showInView:self.view];
使用
[actionSheet showFromTabBar:[[self tabBarController] tabBar]];
代替
[actionSheet showInView:self.view];
這工作正常...... :-)
如果在視圖中使用顯示,則需要從iPhone上的任務欄或工具欄進行顯示,因為它會剪切某些控件。
編寫簡化代碼
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
這項工作很好
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.