Xcode9学习笔记21
来源:互联网 发布:android 网络测速代码 编辑:程序博客网 时间:2024/05/24 06:09
let leftBar = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.refresh, target: self, action: #selector(FirstSubViewController.refresh))//实例化一个工具条按钮对象,它将作为新的的导航按钮 self.navigationItem.leftBarButtonItem = leftBar//将导航栏左侧按钮,设置为新建的工具条按钮对象 let rightBar = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.save, target: self, action: #selector(FirstSubViewController.save))//为导航栏右边的按钮设置新的样式 self.navigationItem.rightBarButtonItem = rightBar//将导航栏右侧按钮,设置为新建的工具条按钮对象 let label = UILabel(frame: CGRect(x: 0, y: 0, width: 180, height: 30))//新建标签对象,用于显示标题区域的文字 label.text = "Happy Day"//设置标签对象的文字内容 label.textAlignment = NSTextAlignment.center//将标签对象的文字对齐方式设置为居中对齐 self.navigationItem.titleView = label//将标签视图对象设置为导航栏的标题区
@objc func refresh() { let alert = UIAlertController(title: "Information", message: "Refresh my feeling.", preferredStyle: UIAlertControllerStyle.alert)//创建一个警告弹出窗口 //创建一个按钮,作为提示窗口中的[确定]按钮,点击时关闭提示窗口 let action = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil) alert.addAction(action)//将确定按钮添加到提示窗口中 self.present(alert, animated: true, completion: nil)//在当前视图控制器中,展示提示窗口 } @objc func save() { print("Saving...") }
阅读全文
0 0
- Xcode9学习笔记21
- Xcode9学习笔记1
- Xcode9学习笔记2
- Xcode9学习笔记3
- Xcode9学习笔记4
- Xcode9学习笔记5
- Xcode9学习笔记6
- Xcode9学习笔记7
- Xcode9学习笔记8
- Xcode9学习笔记9
- Xcode9学习笔记10
- Xcode9学习笔记11
- Xcode9学习笔记12
- Xcode9学习笔记13
- Xcode9学习笔记14
- Xcode9学习笔记15
- Xcode9学习笔记16
- Xcode9学习笔记17
- 交换两个变量
- [bzoj1941]k-d tree 模板
- NOIP2016TGDay2
- BZOJ1011(HNOI2008)[遥远的行星]--估计
- 【搜索】[luoguP1126]机器人搬重物
- Xcode9学习笔记21
- maven仓库清理
- Python 动态类型定义
- UVa1025
- day18DBCP连接池
- 51nod 1503 猪和回文【DP】
- python3 基础教程
- JavaEE学习大纲
- 【动态规划】[luoguP1791]线段覆盖