UITableViewCell 设置
选中cell
//选中第一分区的第一个cell 也可指定其它 cell
[self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:UITableViewScrollPositionNone];
//取消选中状态
[tableView deselectRowAtIndexPath:indexPath animated:NO];
cell 颜色
1.系统默认的颜色设置
1 //无色 2 cell.selectionStyle=UITableViewCellSelectionStyleNone; 3 //蓝色,也就是系统默认的颜色 4 cell.selectionStyle=UITableViewCellSelectionStyleBlue; 5 //灰色 6 cell.selectionStyle=UITableViewCellSelectionStyleGrap;
2.自定义UITableViewCell选中后的背景颜色和背景图片
1 UIColor* color=[[UIColor alloc]initWithRed:50/255.0 green:50/255.0 blue:50/255.0 alpha:1];//通过RGB来定义颜色 2 cell.selectedBackgroundView=[[UIView alloc]initWithFrame:cell.frame]autorelease]; 3 cell.selectedBackgroundView.backgroundColor=[UIColor ***]或color; 4 自定义选中后的背景图片 6 cell.selectedBackgroundView=[[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"backimg.png"]]autorelease]; 5 设置UITableViewCell中的字体颜色时用 8 cell.textLabel.highlightedTextColor=[UIColor **color];
3.定义UITableViewCell的样式
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
accessoryType有如下几种
typedef enum {UITableViewCellAccessoryNone,UITableViewCellAccessoryDisclosureIndicator,UITableViewCellAccessoryDetailDisclosureButton,UITableViewCellAccessoryCheckmark } UITableViewCellAccessoryType; Cell分隔
1.隐藏UITableViewCell的分隔线
[chatTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
typedef enum {UITableViewCellSeparatorStyleNone,UITableViewCellSeparatorStyleSingleLine,UITableViewCellSeparatorStyleSingleLineEtched } UITableViewCellSeparatorStyle;
2.设置UITableViewCell之间分隔线的颜色
[chatTableViewsetSeparatorColor:[UIColor blueColor]];
转载于:https://www.cnblogs.com/wei8/p/3205042.html
UITableViewCell 设置相关推荐
- UITableViewCell设置行距
自定义UITableViewCell设置行距 创建Custom类继承自UITableViewCell 重写其-(instancetype)initWithStyle:(UITableViewCellS ...
- Swift - 表格图片加载优化(拖动表格时不加载,停止时只加载当前页图片)
列表的单元格中包含有图片在开发中很常见.通常我们可以直接在tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIn ...
- ios开发问题汇总(一)
教程汇总 IOS比较好的网络教程:IOS编程浅蓝教程 IOS编程教程(五)自定义UITableView的表单元格 菜鸟教程-iOS教程 开发问题 实现页面切换,网上某些文章写的是: [self.nav ...
- 具有多个单元格类型的iOS UITableView
In this tutorial, we'll be developing an iOS Application using Swift that has a single iOS UITableVi ...
- Swift - UITableView
创建UITablView import UIKitclass ViewController: UIViewController,UITableViewDataSource,UITableViewDel ...
- 800000000000
8000000000题@TOC 不属于使用SDWebImage步骤的是 A:下载SDWebImage的最新SDK B:把SDK导入工程中BackgroundColor C:关闭arc D:如果需 ...
- iOS常见控件的基本使用
文章目录 @[toc] UI相关类继承关系 UIView 常见属性和方法 1. UIView属性 3. UIControl 常用控件 1. UIImageView 图片显示控件(android Ima ...
- iOS UI入门——使用Objective-C和Swift简单实现UITableView
Objective-C代码: #import "ViewController.h"@interface ViewController ()<UITableViewDelega ...
- swift 4 tableViewCell动态加载网络图片问题处理
1. 很多APP都会涉及到资讯或帖子或主题详情页的界面,其中就涉及到cell加载网络图片的开发问题. 2. 最容易想到的思路就是把URL直接传递给cell,让cell的imageView控件直接使用S ...
最新文章
- ftok file php,Linux和PHP中的ftok函数返回值不一致问题跟踪
- C语言强数Strong number算法(附完整源码)
- DataTable添加行的方法
- 电脑打字手指正确姿势_正确的投篮姿势教学,许多人都忽略的细节,学会变投篮神射手...
- python发人人状态
- 为myeclipse分配更大的内存
- mybatis 添加语句返回对象_Mybatis底层源码分析
- 301跳转 https_http跳转https和https跳转http的两种301重定向代码
- Jzoj3898 树的连通性
- Android开发网
- websocket实现实时直播
- 排队模型和排队系统仿真
- JS点击按钮打开新的独立页面
- 【网络空间安全】与【信息安全】专业介绍
- 电信猫的无线无法连接服务器,光纤猫连接路由器无法上网怎么办
- 【软件构造】小谈designing patterns
- 人参果水果宣传文案模版,水果店文案人参果
- 操作系统知识盘点(四)(内存技术)
- 抗阿达木单抗的抗体可能与阿达木单抗治疗过程中静脉和动脉血栓事件相关
- 全民养猪(手机游戏 攻略)