欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

UITableView-常见设置

发布时间:2025/5/22 编程问答 41 豆豆
生活随笔 收集整理的这篇文章主要介绍了 UITableView-常见设置 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

UITableView的常见设置

// 分割线颜色 self.tableView.separatorColor = [UIColor redColor];// 隐藏分割线 self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;// tableView有数据的时候才需要分割线 // 开发小技巧:快速取消分割线self.tableView.tableFooterView = [[UIView alloc] init];

 

UITableViewCell的常见设置

// 取消选中的样式(常用) 让当前 cell 按下无反应 cell.selectionStyle = UITableViewCellSelectionStyleNone;// 设置选中的背景色 UIView *selectedBackgroundView = [[UIView alloc] init]; selectedBackgroundView.backgroundColor = [UIColor redColor]; cell.selectedBackgroundView = selectedBackgroundView;// 设置默认的背景色 cell.backgroundColor = [UIColor blueColor];// 设置默认的背景色 UIView *backgroundView = [[UIView alloc] init]; backgroundView.backgroundColor = [UIColor greenColor]; cell.backgroundView = backgroundView;// backgroundView的优先级 > backgroundColor // 设置指示器 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryView = [[UISwitch alloc] init];

 

转载于:https://www.cnblogs.com/luoze/p/5467595.html

总结

以上是生活随笔为你收集整理的UITableView-常见设置的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。