Popover with ModalPresentationStyle is not centered in iOS 7 iPad

前端 未结 6 1362
悲哀的现实
悲哀的现实 2021-01-31 19:18

I have a problem with iOS 7 that seems to be a bug or I just don\'t do something right. I have modalViewController that appears as a popover on iPad with ModalPresentationStyle.

6条回答
  •  情歌与酒
    2021-01-31 19:36

    The solution above did not work for me. I used the following:

          UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:theViewController];
          navigationController.modalPresentationStyle=UIModalPresentationFormSheet;
          [self presentViewController:navigationController animated:YES completion:nil];
          if([[UIDevice currentDevice] userInterfaceIdiom] != UIUserInterfaceIdiomPhone){
                navigationController.view.superview.frame = CGRectMake(0, 0, 320, 544);
                navigationController.view.frame =CGRectMake(108, 0, 320, 544);
                navigationController.view.superview.backgroundColor=[UIColor clearColor];
          }
    

提交回复
热议问题