UITableView开发需要注意的细节
# 1.隐藏分割线
# 2.隐藏多余Cell
//##?在ViewController初始化时候加载 如viewDidLoad
//隐藏分割线
tableView.separatorStyle = UITableViewCellSeparatorStyle.None
//隐藏多余的cell
tableView.tableFooterView = UIView(frame: CGRectZero)
# 3.分割线头部顶到底、分割线颜色
///##?分割线头部顶到底、分割线颜色
//启动、旋转、视图大小位置发生改变、增加子视图等。。都会调用
override func viewDidLayoutSubviews() {
tableView.separatorInset = UIEdgeInsetsZero
tableView.layoutMargins = UIEdgeInsetsZero
//articleTableView.separatorColor = UIColor.redColor() //分割线颜色
}
//没当cell即将出现屏幕时候都会调用此方法
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.separatorInset = UIEdgeInsetsZero
cell.layoutMargins = UIEdgeInsetsZero
}
# 4.自定义点击后效果 Cell 背景等更改
//##?在cellForRowAtIndexPath方法使用
//点击Cell时,没有点击效果
cell.selectionStyle = UITableViewCellSelectionStyle.None
//系统默认的颜色 .Blue蓝色-默认 .Grap灰色 .None 无色
//点击Cell时,自定义选中后的背景视图
//背景颜色
cell.selectedBackgroundView = UIView()
cell.selectedBackgroundView?.backgroundColor = UIColor.clearColor()
非常好我支持^.^
(0) 0%
不好我反对
(0) 0%
下载地址
UITableView开发需要注意的细节下载
相关电子资料下载
- iOS17.1可能明天发布,iOS17.1主要修复哪些问题? 377
- 华为全新鸿蒙蓄势待发 仅支持鸿蒙内核和鸿蒙系统应用 719
- 苹果手机系统iOS 17遭用户质疑 731
- iPhone12辐射超标?苹果推送iOS 17.1解决此事 750
- 传华为囤积零部件 目标明年智能手机出货7000万部;消息称 MiOS 仅限国内,小米 28208
- 苹果推送iOS17.0.3,解决iPhone15Pro系列存在机身过热 216
- Testin云测兼容和真机服务平台中上线iPhone 15系列手机 208
- 利尔达推出搭载HooRiiOS的Matter模组 145
- 运放参数解析:输入偏置电流(Ibias)和失调电流(Ios) 128
- 昆仑太科发布支持国产飞腾腾锐D2000芯片的开源BIOS固件版本 448