我正在开发一个必须颠倒的应用程序。我想向用户显示一个对话框,他可以接受(这将导致自动旋转(或下降。
如何使用Objective-C显示这样的对话框?我需要在info.plist中以及在支持的接口方向上进行编程中的肖像模式。对吗?
非常感谢您的帮助!
为此使用uialertController。
UIAlertController * alert=[UIAlertController
alertControllerWithTitle:@"Title" message:@"Message"preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* yesButton = [UIAlertAction
actionWithTitle:@"Yes, please"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
**//What we write here????????**
NSLog(@"you pressed Yes, please button");
// call method whatever u need
}];
UIAlertAction* noButton = [UIAlertAction
actionWithTitle:@"No, thanks"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
**//What we write here????????**
NSLog(@"you pressed No, thanks button");
// call method whatever u need
}];
[alert addAction:yesButton];
[alert addAction:noButton];
[self presentViewController:alert animated:YES completion:nil];`