[英]Don't want to dismiss popover in Titanium when user touches outside of the popover
[英]Disabling ActionSheet dismiss on ipad when user touches outside popover
我在我的應用程序中顯示了一個動作表,它在iphone上運行正常。 但是,在ipad上它會自動在彈出窗口中創建動作表,我無法通過它來禁用用戶觸摸動作表之外的消息。
我已經更改了為ipad顯示操作表的方式,現在顯示如下:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Choose a preloaded picture", @"Use a photo", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
actionSheet.tag = 1;
[actionSheet showFromRect:CGRectMake(100, 0, 300, 300) inView:self.view animated:YES];
[actionSheet release];
我也試過用。
- (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController
{
return NO;
}
關於當用戶觸摸操作表外時如何阻止uiactionsheet popover解散的任何想法?
你的popoverControllerShouldDismissPopover:
方法不會被調用,因為它是一個UIPopoverControllerDelegate方法,你正在處理一個UIActionSheet。 由於UIKit會自動為您創建彈出控制器,因此您將無法設置其委托。 您可以使用[popoverActionsheet superview]
訪問[popoverActionsheet superview]
視圖本身,但這不會為您提供UIPopoverController。
從用戶體驗的角度來看,Apple會要求您不要實現這樣的行為 - 如果您需要以模態方式呈現選項(在用戶做出選擇之前它們不會消失),那么用戶將更熟悉UIAlertView,或您自己的模態呈現的視圖控制器 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.