ios9 之后,Xcode7不推荐使用UIAlertView,改用UIAlertController+UIAlertAction(按钮)

        /**

         *  ios9 之后,Xcode7不推荐使用UIAlertView,改用UIAlertController+UIAlertAction(按钮)

         */

        UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:@"First" message:@"第一次进入app" preferredStyle:UIAlertControllerStyleAlert];

        UIAlertAction *leftAction = [UIAlertAction actionWithTitle:@"确定" style: UIAlertActionStyleDefault handler:nil];

        UIAlertAction *rightAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];

        [alertCtrl addAction:leftAction];

        [alertCtrl addAction:rightAction];

        //当是多个按钮的时候,会变成一列按钮。。。

        [self presentViewController:alertCtrl animated:YES completion:nil];

原文地址:https://www.cnblogs.com/lrr0618/p/5160634.html