I have this problem: here is my code:
我有这个问题:这是我的代码:
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Share the race" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Send with mail" otherButtonTitles:nil];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[popupQuery showInView:self.view];
[popupQuery release];
and everything seems ok, the 2 buttons are showed right, the "send with mail" button is ok, but the cancel catch the click only on the upper side... here a shot that illustrate the situation:
一切似乎都没问题,2个按钮显示正确,“发送邮件”按钮没问题,但取消只在上方抓住点击...这里有一个说明情况的镜头:
how can I solve this?
我该怎么解决这个问题?
thanks:)
谢谢:)
3 个解决方案
#1
37
My guess is that the bottom portion of the UIActionSheet
extends beyond the bounds of the view, and so doesn't respond to touches.
我的猜测是UIActionSheet的底部超出了视图的范围,因此不会对触摸做出响应。
To test this theory, add another button and see if all upper buttons work fine but the bottom button still exhibits this behavior.
要测试此理论,请添加另一个按钮,看看是否所有上部按钮都正常工作,但底部按钮仍然显示此行为。
To fix this problem, make sure the view extends to the bottom of the screen. If you have a tabBar in your app, that's going to be my suspect for the problem. You could use showFromTabBar:
if you want the sheet above the tabBar, or showFromToolbar:
to show it from a toolBar.
要解决此问题,请确保视图延伸到屏幕底部。如果你的应用程序中有一个tabBar,那将是我怀疑的问题。您可以使用showFromTabBar:如果您希望tabBar上方的工作表或showFromToolbar:从工具栏中显示它。
If you don't have a bottom bar, then I'm wrong and have no idea.
如果你没有底栏,那我就错了,不知道。
#2
7
You should show the action sheet as a subview of the application window, not of the current view.
您应该将操作表显示为应用程序窗口的子视图,而不是当前视图的子视图。
UIActionSheet *actionSheet = [[UIActionSheet alloc] init...];
// ...
[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
May be it will help others.
可能会帮助别人。
Happy Coding :)
快乐编码:)
#3
2
use
使用
[actionSheet showFromTabBar:[[self tabBarController] tabBar]];
instead of
代替
[actionSheet showInView:self.view];
#1
37
My guess is that the bottom portion of the UIActionSheet
extends beyond the bounds of the view, and so doesn't respond to touches.
我的猜测是UIActionSheet的底部超出了视图的范围,因此不会对触摸做出响应。
To test this theory, add another button and see if all upper buttons work fine but the bottom button still exhibits this behavior.
要测试此理论,请添加另一个按钮,看看是否所有上部按钮都正常工作,但底部按钮仍然显示此行为。
To fix this problem, make sure the view extends to the bottom of the screen. If you have a tabBar in your app, that's going to be my suspect for the problem. You could use showFromTabBar:
if you want the sheet above the tabBar, or showFromToolbar:
to show it from a toolBar.
要解决此问题,请确保视图延伸到屏幕底部。如果你的应用程序中有一个tabBar,那将是我怀疑的问题。您可以使用showFromTabBar:如果您希望tabBar上方的工作表或showFromToolbar:从工具栏中显示它。
If you don't have a bottom bar, then I'm wrong and have no idea.
如果你没有底栏,那我就错了,不知道。
#2
7
You should show the action sheet as a subview of the application window, not of the current view.
您应该将操作表显示为应用程序窗口的子视图,而不是当前视图的子视图。
UIActionSheet *actionSheet = [[UIActionSheet alloc] init...];
// ...
[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
May be it will help others.
可能会帮助别人。
Happy Coding :)
快乐编码:)
#3
2
use
使用
[actionSheet showFromTabBar:[[self tabBarController] tabBar]];
instead of
代替
[actionSheet showInView:self.view];