簡體   English   中英

UIActionSheet取消按鈕不解除動作表

[英]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]];

UIActionSheet取消按鈕奇怪的行為

這將成功

[actionSheet showInView:[self.view window]];

代替

[actionSheet showInView:self.view];

使用

[actionSheet showFromTabBar:[[self tabBarController] tabBar]];

代替

[actionSheet showInView:self.view];

這工作正常...... :-)

如果在視圖中使用顯示,則需要從iPhone上的任務欄或工具欄進行顯示,因為它會剪切某些控件。

編寫簡化代碼

 actionSheet.actionSheetStyle = UIActionSheetStyleDefault;

這項工作很好

我在這里找到了答案。

https://stackoverflow.com/a/1530259/1803218

[menu sendSubviewToBack:pickerView];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM