我试图弄清楚如何在我的 iMessage 应用程序扩展中显示UIAlertController
一个风格。UIAlertControllerStyleActionSheet
问题是,当调用时,操作表出现在原生 iMessage 文本字段下方:
[self.view.window.rootViewController presentViewController:actionSheetController animated:YES completion:NULL];
我将如何解决这个问题?
代码:
UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"Clear", nil) message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *clear = [UIAlertAction actionWithTitle:NSLocalizedString(@"Clear", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action)
{
[self clear];
}];
UIAlertAction *cancel = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action)
{}];
[actionSheetController addAction:clear];
[actionSheetController addAction:cancel];
[self.view.window.rootViewController presentViewController:actionSheetController animated:YES completion:NULL];