0

私は tabbarcontroller と 2 つのコントローラーを備えたアプリを持っており、1 つのコントローラーでポートレート モデルの uiactionsheet を表示しています。

UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:nil cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Del" otherButtonTitles:nil,nil];

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

そして、モードをランドスケープに変更すると、コントローラーデリゲートに応答しないため、機能しないことがわかりました。

-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

アクションシートが表示されない場合、コントローラーはランドスケープに変更できますが、なぜですか? どうもありがとうございました!!!

4

1 に答える 1

3

これを試して:

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];
  }
于 2013-02-07T04:26:20.097 に答える