Popover with ModalPresentationStyle is not centered in iOS 7 iPad

前端 未结 6 1366
悲哀的现实
悲哀的现实 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:35

    For me the issue was calling becomeFirstResponder on a text field in the viewDidAppear of the presented view controller. Appears to be a bug with that now. The solution was wrapping it in a simple dispatch_async:

    - (void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:animated];
        dispatch_async(dispatch_get_main_queue(), ^{
            [self.userNameTextField becomeFirstResponder];
        });
    }
    

提交回复
热议问题