klc*_*r89 13 objective-c ios msmessage
我正在试图弄清楚如何在我的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];
Run Code Online (Sandbox Code Playgroud)
这是一个解决方法。也许添加一点动画以使其流畅。
[self.view.window.rootViewController presentViewController:actionSheetController animated:YES completion:^{
actionSheetController.view.frame = CGRectOffset(actionSheetController.view.frame, 0, -40);
}];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1607 次 |
| 最近记录: |