Я пытаюсь отобразить UIAlertController с помощью некоторых кнопок действий. Он отлично работает на iPhone, потому что он появляется со дна устройства. У меня проблема с ipad, UIAlertController не центрируется должным образом. Он показывает немного вправо. Я могу вычесть из координаты x, вычитая say 150f. Есть ли способ получить это в центре?UIAlertController - iOS 8 - iPad - не правильно настроен
UIAlertController * view= [UIAlertController
alertControllerWithTitle:@"My Title"
message:@"Select your Choice"
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction* ok = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
//Do some thing here
[view dismissViewControllerAnimated:YES completion:nil];
}];
UIAlertAction* cancel = [UIAlertAction
actionWithTitle:@"Cancel"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[view dismissViewControllerAnimated:YES completion:nil];
}];
[view addAction:ok];
[view addAction:cancel];
view.popoverPresentationController.sourceView = self.view;
view.popoverPresentationController.sourceRect = CGRectMake(self.view.bounds.size.width/2.0, self.view.bounds.size.height/2.0, 0.0, 0.0);
[self presentViewController: view animated:YES completion:nil];
Что такое 'self.view.frame' относительно' [UIScreen mainScreen] .bounds'? Является ли он идеально сосредоточенным? – Stuart