Obj-C, why is my UIActionSheet Cancel button hard to tap?
I've noticed in my app that my cancel button is hard to tap, it seem like the hit area is not in the center.
How do I fix this ?
Her开发者_如何转开发es my code...
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];
I think your problem lies in the [actionSheet showInView:vw];
, perhaps you are using tabBarController/toolBar in you application(at bottom), this error occurs at that time.
you should use either showFromToolbar
or showFromTabBar
as per your design. If your design is different then please mention it.(if no tabBar/toolBar there).
Thanks
agree whit Ravin answer and you can try
[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
it can help also
I have similar problem in iOS 8, using UIAlertController
with style UIAlertControllerStyleActionSheet
.
The problem is that the first tap on the action sheet is ignored.
Turned out it got to do with my text field's keyboard interfering with the touches.
The fix is to dismiss the keyboard first, then present the action sheet.
[textfield resignFirstResponder];
[self presentViewController:alert animated:YES completion:nil];
精彩评论