swift UItableView和自定义uitableViewCell
2015-07-29 15:22
411 查看
新建swift uitableViewCell storybord文件
往center View里面拖入控件,设置Identifier
拿到tableView的映射
@IBOutlet
weak var radarTableView:
UITableView!
override
func viewDidLoad() {
super.viewDidLoad()
self.view.layer.contents=UIImage(named:
"bg_2")?.CGImage
//注册cell
radarTableView.registerNib(UINib(nibName:
"mapTableViewCell", bundle:
nil), forCellReuseIdentifier: "mapCell")
radarTableView.separatorStyle=UITableViewCellSeparatorStyle.None//去线条
}
//返回cell高度
func tableView(tableView:
UITableView, heightForRowAtIndexPath indexPath:
NSIndexPath) -> CGFloat {
return
110
}
//返回cell行数
func tableView(tableView:
UITableView, numberOfRowsInSection section:
Int) -> Int {
return
5
}
//返回组数
func numberOfSectionsInTableView(tableView:
UITableView) -> Int {
return
1
}
//设置cell
func tableView(tableView:
UITableView!, cellForRowAtIndexPath indexPath:NSIndexPath!) ->
UITableViewCell!{
let cellIdentifier =
"mapCell"
//
var cell:mapTableViewCell = tableView!.dequeueReusableCellWithIdentifier("mapCell",
forIndexPath: indexPath)as!
mapTableViewCell
// let row = indexPath.row
return cell
}
往center View里面拖入控件,设置Identifier
拿到tableView的映射
@IBOutlet
weak var radarTableView:
UITableView!
override
func viewDidLoad() {
super.viewDidLoad()
self.view.layer.contents=UIImage(named:
"bg_2")?.CGImage
//注册cell
radarTableView.registerNib(UINib(nibName:
"mapTableViewCell", bundle:
nil), forCellReuseIdentifier: "mapCell")
radarTableView.separatorStyle=UITableViewCellSeparatorStyle.None//去线条
}
//返回cell高度
func tableView(tableView:
UITableView, heightForRowAtIndexPath indexPath:
NSIndexPath) -> CGFloat {
return
110
}
//返回cell行数
func tableView(tableView:
UITableView, numberOfRowsInSection section:
Int) -> Int {
return
5
}
//返回组数
func numberOfSectionsInTableView(tableView:
UITableView) -> Int {
return
1
}
//设置cell
func tableView(tableView:
UITableView!, cellForRowAtIndexPath indexPath:NSIndexPath!) ->
UITableViewCell!{
let cellIdentifier =
"mapCell"
//
var cell:mapTableViewCell = tableView!.dequeueReusableCellWithIdentifier("mapCell",
forIndexPath: indexPath)as!
mapTableViewCell
// let row = indexPath.row
return cell
}
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- Apple Swift学习教程
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- js判断客户端是iOS还是Android等移动终端的方法
- IOS开发环境windows化攻略
- Swift中实现点击、双击、捏、旋转、拖动、划动、长按手势的类和方法介绍
- Swift中定义二维数组的方法及遍历方法示例
- .net平台推送ios消息的实现方法
- 探讨Android与iOS,我们将何去何从?
- Android、iOS和Windows Phone中的推送技术详解
- 简单分析Swift语言的一些基本特征
- Swift与C语言指针结合使用实例
- Swift心得笔记之控制流
- IOS 改变键盘颜色代码