iOS笔记【UIAlertCotroller】 2017-09-06

1.种类
    中部提示框-alert
    底部提示框-actionSheet
2.菜单项参数
    title:标题        取消
    style:样式        .cencel
    handle:nil        误操作
    把菜单项添加到UIAlertController:使用addAction方法
    显示菜单:使用self.present
 
// MARK: - Table view delegate
// 单元格点击
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        // print("您点击了\(indexPath.section)组,\(indexPath.row)行")
   let menu = UIAlertController(title: "提示", message: "您点击了\(indexPath.section)组,\(indexPath.row)行", preferredStyle: .alert)
   let option = UIAlertAction(title: "确认", style: .default, handler: nil)
   let option2 = UIAlertAction(title: "取消", style: .cancel, handler: nil)
   let option3 = UIAlertAction(title: "删除", style: .destructive, handler: nil)
   menu.addAction(option)
   menu.addAction(option2)
   menu.addAction(option3)
   menu.addAction(option)
   self.present(menu, animated: true, completion: nil)
}

 

posted @ 2017-09-09 23:02  雪随冬行  阅读(223)  评论(0编辑  收藏  举报