Obj-C,为什么我的UIActionSheet取消按钮难以点击?

时间:2011-04-19 07:10:22

标签: ios cocoa-touch uiactionsheet

我在我的应用程序中注意到我的取消按钮很难点击,看起来命中区域不在中心。

我该如何解决这个问题?

继承我的代码......

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"" 
  delegate:dg 
  cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
  otherButtonTitles: @"Help Pages", @"Tutorial", 
  @"Feedback / Questions ", @"Facebook Group", @"About", nil];

actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheet setTag:CommonUIActionSheetHelp];
[actionSheet showInView:vw];
[actionSheet release];

3 个答案:

答案 0 :(得分:6)

我认为您的问题在于[actionSheet showInView:vw];,也许您在应用程序中使用tabBarController / toolBar(在底部),此时会发生此错误。

根据您的设计,您应该使用showFromToolbarshowFromTabBar。如果您的设计不同,请提及它。(如果没有tabBar / toolBar)。

由于

答案 1 :(得分:5)

同意Ravin的答案,你可以尝试

[actionSheet showInView:[UIApplication sharedApplication].keyWindow];

它也可以帮助

答案 2 :(得分:0)

我在iOS 8中遇到类似问题,使用UIAlertController样式UIAlertControllerStyleActionSheet

问题是操作表上的第一次点击被忽略。

原来这与我的文本字段的键盘干扰了触摸有关。

修复方法是首先关闭键盘,然后显示操作表。

[textfield resignFirstResponder];
[self presentViewController:alert animated:YES completion:nil];