二者都可实现弹窗功能:
UIAlertView:
//用button触发
- (void)button{
UIAlertView *alterView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"网络不给力...." delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"继续",@"再试一次", nil];
[alterView show];
}
UIAlertController
- (void)button{
UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"提示" message:@"网速不给力..." preferredStyle:(UIAlertControllerStyleAlert)];
[self presentViewController:controller animated:YES completion:nil];
UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:nil];
UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"继续" style:(UIAlertActionStyleDefault) handler:nil];
UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"再试一次" style:(UIAlertActionStyleDestructive) handler:nil];
[controller addAction:action1];
[controller addAction:action2];
[controller addAction:action3];
}
二者区别和联系