首页 > 其他 > 详细

UITableView属性方法使用大全

时间:2015-06-30 23:17:30      阅读:266      评论:0      收藏:0      [点我收藏+]

 

//设置分割线颜色

[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

 

 

新手上路~请多多指教  

UITableView属性方法使用大全

原文:http://www.cnblogs.com/mengxz0626/p/4612015.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!