Ios8 对同一应用程序使用UIAlertView和UIAlertController

Ios8 对同一应用程序使用UIAlertView和UIAlertController,ios8,uialertview,uialertcontroller,Ios8,Uialertview,Uialertcontroller,我想显示一个警报。但是,由于iOS 8不推荐使用uialertView,我可以做些什么来显示这两种操作系统的警报?尝试使用此代码片段在iOS 8中显示警报视图。这肯定会起作用。 -(iAction)BTN1已单击:(ui按钮*)发件人{ //警报样式 UIAlertController*alert=[UIAlertController alertControllerWithTitle:@“alert!”消息:@“您将做什么?”首选样式:UIAlertControllerStyleAlert] _

我想显示一个警报。但是,由于iOS 8不推荐使用uialertView,我可以做些什么来显示这两种操作系统的警报?

尝试使用此代码片段在iOS 8中显示警报视图。这肯定会起作用。

-(iAction)BTN1已单击:(ui按钮*)发件人{

//警报样式
UIAlertController*alert=[UIAlertController alertControllerWithTitle:@“alert!”消息:@“您将做什么?”首选样式:UIAlertControllerStyleAlert]

__weak ViewController *wself = self;

// Make choices for the user using alert actions.
**UIAlertAction** *doSomethingAction = [UIAlertAction actionWithTitle:@"I'm doing something" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
    __strong ViewController *sself = wself;
    sself.alertResponseLabel.text = @"You did something!";
}];

 UIAlertAction *doNothingAction = [UIAlertAction actionWithTitle:@"I'm totally ignoring this" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
    __strong ViewController *sself = wself;
    sself.alertResponseLabel.text = @"OK, just ignore me...";
}];

// Add actions to the controller so they will appear
[**alert addAction:doSomethingAction];
[alert addAction:doNothingAction];**
 alert.view.tintColor = [UIColor blackColor];
**[self presentViewController:alert animated:YES completion:nil];**  }

可能的副本是重复的…这是我一直在寻找的。谢谢!