ios – UIActionSheet被其超级视图剪辑,我没有工具栏或Tabbar

前端之家收集整理的这篇文章主要介绍了ios – UIActionSheet被其超级视图剪辑,我没有工具栏或Tabbar前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的应用程序使用UINavigationController,但是我不显示工具栏,因为我的导航都是由游戏中的控件控制的.

我没有Tab栏,因为我没有使用TabBarController.

我的游戏应用程序只是Landscape.

这是我以前创建并呈现的UIActionSheet:

UIActionSheet *quitGameSheet = [[UIActionSheet alloc] 
     initWithTitle:@"Quit your game?" 
     delegate:self
     cancelButtonTitle:@"Cancel"
     destructiveButtonTitle:@"Yes,quit game"
     otherButtonTitles:nil];
[quitGameSheet showInView:self.view];

但是,UIActionSheet大多是关闭屏幕,我得到这个错误

Presenting action sheet clipped by its superview. Some controls might not respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:].

但是,我没有工具栏,我没有标签栏.

我已经尝试了几个其他Stack Overflow的答案,其中没有哪个适用于我:

Issue with UIActionSheet

我尝试从self.navigationController.view,从self.parentViewController.view,从我创建的CGRect,在视图的底部,从self.view.bounds,因为我是绝望的.我.

它适用于iOS 6,但在iOS 7中不起作用.以下是在iOS 6上运行的几个屏幕截图,并在iOS 7上失败.

任何帮助?

更新1 —

这是根据请求的视图层次结构

<UIView: 0xc480380; frame = (0 0; 568 320); autoresize = RM+BM; layer = <CALayer: 0xc4803e0>>
   | <UIImageView: 0xc480410; frame = (0 0; 568 320); opaque = NO; autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0xc4804a0>>
   | <UIButton: 0xc47b370; frame = (203 107; 159 37); opaque = NO; autoresize = LM+RM+BM; layer = <CALayer: 0xc47a730>>
   |    | <UIImageView: 0xc475150; frame = (0 0; 159 37); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xc4751e0>>
   | <UIButton: 0xc478a00; frame = (203 152; 159 37); opaque = NO; autoresize = LM+RM+BM; layer = <CALayer: 0xc477dd0>>
   |    | <UIImageView: 0xc475030; frame = (0 0; 159 37); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xc4750c0>>
   | <UISwitch: 0xc47dcc0; frame = (313 65; 51 31); opaque = NO; autoresize = LM+RM+BM; layer = <CALayer: 0xc47d180>>
   |    | <_UISwitchInternalViewNeueStyle1: 0xc47e040; frame = (0 0; 51 31); gestureRecognizers = <NSArray: 0xc47ffa0>; layer = <CALayer: 0xc47e140>>
   |    |    | <UIView: 0xc47e4e0; frame = (35.5 0; 15.5 31); clipsToBounds = YES; layer = <CALayer: 0xc47e540>>
   |    |    |    | <UIView: 0xc47e330; frame = (-35.5 0; 51 31); layer = <CALayer: 0xc47e390>>
   |    |    | <UIView: 0xc47e450; frame = (0 0; 35.5 31); clipsToBounds = YES; layer = <CALayer: 0xc47e4b0>>
   |    |    |    | <UIView: 0xc47e3c0; frame = (0 0; 51 31); layer = <CALayer: 0xc47e420>>
   |    |    | <UIView: 0xc47f750; frame = (0 0; 51 31); layer = <CALayer: 0xc47f7b0>>
   |    |    |    | <UIImageView: 0xc47f480; frame = (39 16; 0 0); alpha = 0; userInteractionEnabled = NO; layer = <CALayer: 0xc47f660>>
   |    |    |    | <UIImageView: 0xc47f690; frame = (12 16; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0xc47f720>>
   |    |    | <UIImageView: 0xc47e680; frame = (7 -6; 57 43.5); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xc47f2f0>>
   | <UILabel: 0xc480610; frame = (173 63; 96 29); text = 'Sounds:'; clipsToBounds = YES; opaque = NO; autoresize = LM+RM+BM; userInteractionEnabled = NO; layer = <CALayer: 0xc480540>>
   | <UIButton: 0xc473a20; frame = (203 197; 159 37); opaque = NO; autoresize = LM+RM+BM; layer = <CALayer: 0xc473590>>
   |    | <UIImageView: 0xc474f30; frame = (0 0; 159 37); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0xc474fc0>>

解决方法

在同一个应用程序中,我看起来是一个完全不相关的问题,其中屏幕左侧的一些按钮不可插拔.

Can’t tap buttons on the left side of 4″ iPhone

在调查我发现我的UIWindow是320×480.问题出在我的MainWindow.xib中. Xcode为我创建了这个xib,但它可能是Xcode 3,它是几年前.我决定检查设置,并注意到“启动时的全屏”选项.我在文档中查找了该选项,并且有一个注释说明这应该始终保持一致,以便窗口被正确调整大小以匹配设备大小.当iPhone只有一种尺寸的iPhone时,这并不是一个问题,而是引入了4“iPhone的问题.

所以,我检查了这个框,重新启动和中提琴,这个和另一个问题解决了,因为封闭的UIWindow的大小正确.

原文链接:https://www.f2er.com/iOS/335927.html

猜你在找的iOS相关文章