UIAlertController 在ipad中需要配置一下挂靠的控件,而在iphone却不需要的。
下面代码可以适配
UIAlertController *alert = [UIAlertController
alertControllerWithTitle:NSLocalizedString(@"分组管理",nil)
message:[NSString stringWithFormat:NSLocalizedString(@"分组:%@, 请选择您要进行的操作",nil),title]
preferredStyle:UIAlertControllerStyleActionSheet
];
if([EzSystemInfo isDevicePad])
{
UIPopoverPresentationController *popPresenter = [alert
popoverPresentationController];
popPresenter.sourceView = cell;
popPresenter.sourceRect = cell.bounds;
[self presentViewController:alert animated:YES completion:nil];
}
else
[self presentViewController:alert animated:YES completion:nil];