2

你好,我是 Xcode 和 iOS 编程的新手。我在操作表和警报中遇到了一些问题,必须按两次才能工作。它还说:“呈现由其超级视图剪辑的操作表”。某些控件可能无法响应触摸。在 iPhone 上尝试 -[UIActionSheet showFromTabBar:] 或 -[UIActionSheet showFromToolbar:] 而不是 -[UIActionSheet showInView:]。

{
    UIActionSheet   *actionSheet = [[UIActionSheet alloc]
                                  initWithTitle:@"¿?" delegate:self cancelButtonTitle:@"No" destructiveButtonTitle:@"Send" otherButtonTitles:nil];

    [actionSheet showInView:self.view];
}

任何帮助将不胜感激谢谢!

4

4 回答 4

5

您需要将其放在标签栏(或工具栏)中,而不是:

 [actionSheet showInView:self.view];

 [actionSheet showFromTabBar:self.tabBarController.tabBar];
于 2012-06-18T20:51:51.453 回答
1

If your application is using a navigation bar (and not a tool bar) on the screen where you want to present the UIActionSheet, try to present it on the tool bar of the navigation controller.

This would also present the action sheet even if you have hidden your navigation controller's toolbar.

[myActionSheet showInView:self.navigationController.toolbar]

于 2012-09-28T07:02:09.063 回答
0

此方法也有效,它隐藏了“Prepresenting action sheet clipped by its superview”警告。

[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
于 2013-08-14T05:53:55.273 回答
0

[actionSheet showInView:self.parentViewController.view];如果您使用 tabbar 或 naviatinbar,我有同样的问题,我使用而不是 self.view 解决了

于 2012-05-12T09:20:49.560 回答