标签:
//设置分割线颜色
[self.left_tableView setSeparatorColor:[UIColor blackColor]];
代理方法:使用前记得绑定delegate与datasource
//UITableView返回行数 section判断不同分区返回不同的行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
//设置行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//设置tableViewcell返回数据
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//根据xib 获取cellfangshi imgTableViewcell 是你自定义的cell 的名字
NSArray * arr=[[NSBundle mainBundle] loadNibNamed:@"imgTableViewCell" owner:nil options:nil];
cell=[arr lastObject];
// 设置cell选中时cell 的颜色
cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame] ;
cell.selectedBackgroundView.backgroundColor = [UIColor colorWithRed:6/255.0 green:120/255.0 blue:169/255.0 alpha:1];
//UItableView 返回几个区
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
// 设置区头高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//设置区头样式 返回一个 设计好的 UIView 做为区头样式
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
//UITableview 区头简单返回字符串
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
//设置选中事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
新手上路~请多多指教
标签:
原文地址:http://www.cnblogs.com/mengxz0626/p/4612015.html