# 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条评论
快来发表一下你的评论吧 !