首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

UITableView惯用的数据源方法和委托方法

2013-10-24 
UITableView常用的数据源方法和委托方法- (UIView *)tableView:(UITableView *)tableView viewForHeaderIn

UITableView常用的数据源方法和委托方法

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *headerView=[[[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)] autorelease]; headerView.backgroundColor=[UIColor yellowColor]; UILabel *label=[[[UILabel alloc] initWithFrame:CGRectMake(20, 20, 300, 30)] autorelease]; label.text=@"header"; [headerView addSubview:label]; return headerView;}- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ UIView *headerView=[[[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 40)] autorelease]; headerView.backgroundColor=[UIColor redColor]; UILabel *label=[[[UILabel alloc] initWithFrame:CGRectMake(20, 20, 300, 30)] autorelease]; label.text=@"foot"; [headerView addSubview:label]; return headerView;}



热点排行