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)
}
原文:http://www.cnblogs.com/lizhipengvvip/p/7499668.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!