swiftUI基础 使用storyboard建立UITableView
来源:互联网 发布:java定义整形变量关键 编辑:程序博客网 时间:2024/05/16 09:05
1首先建一个UIStoryboard,默认使用Main 也是官方推荐
2绑定ViewController
3拖拽一个UITableView 设置代理为ViewController
4在ViewController实现代理方法
很简单上图
viewController.swift文件
import UIKitclass ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { override func viewDidLoad() { super.viewDidLoad() } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } //Number of rows func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 4 } //DetailCells func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ let cell:UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: nil) cell.textLabel!.text = "Cell text" cell.detailTextLabel?.text = "Cell Subtitle" cell.imageView!.image = UIImage(named:"image1.png") return cell } //Title func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String?{ return "Head" } //Foot Subtitle func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String?{ return "Foot" } }
运行结果:
0 0
- swiftUI基础 使用storyboard建立UITableView
- swiftUI基础值UIImagePickerController
- swiftUI基础 滑动手势UISwipeGestureRecognizer
- 使用storyBoard方式的UITableView注意事项
- UITableView使用基础篇
- 在 Xcode 5 的 Storyboard 中使用 UITableView
- swift中UITableView的基本使用(基于Storyboard):适用新手
- Xcode6 IOS开发UITableView基于Storyboard的使用
- xcode 4.3.2 storyboard绘制UITableView为理解storyboard使用和tableview有用
- UITableView使用,建立二级功能栏
- iOS基础:UITableView简单使用
- storyboard的跳转 传值 基础使用详解
- 使用StoryBoard来建立导航控制器和表视图
- Xcode6使用storyboard在TabBarController上建立三个以上Item
- Xcode6使用storyboard在TabBarController上建立三个以上Item
- Xcode6使用storyboard在TabBarController上建立三个以上Item
- Storyboard中 UIViewController+UITableView使用 autolayout引起的界面布局问题
- 使用storyboard
- 使用python来调试串口
- 父子控制器
- 原型工具 比较好的
- ViewPager的详细学习(一)
- mysql
- swiftUI基础 使用storyboard建立UITableView
- 每日命令:过滤命令cut、sort、uniq、wc、tee、head、tail、grep、
- 中间件通俗理解
- Mac/windows Intellij IDEA 15 JRebel6.4.5 破解
- AndroidStudio使用*.9.png
- applicationContext.xml
- oracle笔记1-FUNCTION 函数
- FreeMarker内建函数
- mjrefresh自动判断是否隐藏mj_footer