iOS 9 警告視圖

  • 在遇到某些情況時需要提示用戶某些信息并執行某些修正動作,這時要用到警告視圖,而在iOS9的時候UIAlertView已經被廢棄了,取而代之的時UIAlertController。 直接貼代碼:
    //創建并初始化警告視圖控制器 UIAlertController\* alertController = [UIAlertController alertControllerWithTitle:@"這里是標題" message:@"這里是提示信息" preferredStyle:UIAlertControllerStyleAlert]; //創建并初始化action UIAlertAction\* yesAction = [UIAlertAction actionWithTitle:@"確定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction\* _Nonnull action){ //do something.. }]; [alertController addAction: yesAction]; [self presentViewController: alertController animated:YES completion:nil];
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容