【问题标题】:Why UIActionSheet not support my landscape?为什么 UIActionSheet 不支持我的风景?
【发布时间】:2013-02-07 02:03:08
【问题描述】:

我有一个带有 tabbarcontroller 的应用程序,有两个控制器,现在在一个控制器中我以纵向模型显示 uiactionsheet:

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"" 委托:无取消按钮标题:@“取消” 破坏性按钮标题:@“Del” otherButtonTitles:nil,nil];

actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[actionSheet showInView:self.view];
actionSheet.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin;
[actionSheet release];

我发现当我将模式更改为横向时,它不起作用,因为它没有响应控制器委托:

-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 持续时间:(NSTimeInterval)duration

如果 actionsheet 不显示,控制器可以更改为 Landscape,为什么?非常感谢!!!

【问题讨论】:

标签: iphone ios objective-c uiactionsheet


【解决方案1】:

试试这个:

UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Some text..."
                           delegate:self
                  cancelButtonTitle:@"Cancel"
             destructiveButtonTitle:@"Delete"
                  otherButtonTitles:@"Button 1",@"Button 2",nil];

  if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 3.0 ||
      UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
    [sheet showInView:self.view];
  } else {
    [sheet showInView:self.view.window];
  }

【讨论】:

  • 对不起,它不起作用。我发现当我使用 [sheet showInView:self.view] 并显示一个具有纵向模式的 UIActionSheet,然后转到横向模式时,它不响应委托:-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 持续时间:( NSTimeInterval)duration 为什么???
  • 好的,我得到了答案:stackoverflow.com/questions/4859352/…
猜你喜欢
  • 2012-11-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-20
相关资源
最近更新 更多