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

4

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

我该如何解决这个问题?

这是我的代码...

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个回答

6
我认为你的问题在于 [actionSheet showInView:vw];,可能是因为你的应用程序使用了tabBarController/toolBar(在底部),这时会出现此错误。
根据你的设计,你应该使用showFromToolbarshowFromTabBar。如果你的设计不同,请说明。(如果没有tabBar/toolBar)。
谢谢。

5

我同意Ravin的回答,你可以尝试一下

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

它也可以帮助


0

我在iOS 8中遇到了类似的问题,使用带有样式UIAlertControllerStyleActionSheetUIAlertController

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

结果发现是我的文本字段键盘干扰了触摸事件。

解决方法是先关闭键盘,然后再显示操作表。

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接