1.tableView的格式区别
选择UITableViewStyleGrouped方式会全部显示,UITableViewStylePlain则在上拉的时候,把组头顶在顶部。
iOS7中,如果用UITableViewStyleGrouped的话,里面的 cell会比原来的拉长了 (效果和UITableViewStylePlain一样了),这样做应该是为了统一和UITableViewStylePlain风格时cell的大小一致,而且在iOS7中,使用UITableViewStyleGrouped风格时,上面会出现 headView ,大概占了35个像素。
2.tableView解决组之间的间隔
@proper(nonatomic) CGFloat sectionHeaderHeight 在delegate未实现tableView:heightForHeaderInSection:方法时才使用。(注:当我们在代理中)
3.UItableViewCell自带的四种格式
定义自带属性值
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString * identifier= @"cell"; UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:identifier]; } cell.backgroundColor = [UIColor grayColor]; //自适应图片(大小) cell.textLabel.text = @"主题"; cell.imageView.image = [UIImage imageNamed:@"关于我们@2x.png"]; cell.detailTextLabel.text = @"副主题"; return cell; }
UITableViewCellStyleDefault(左边一张图,一个标题)
UITableViewCellStyleValue1(左边一张图 一个主题,右边副主题)
UITableViewCellStyleValue2(一个主题一个副主题)
UITableViewCellStyleSubtitle(一张图,一个主题,一个副主题(副主题在主题下面))
我们在开发过程中tableView使用非常广泛,但是有一些格式我们没有必要自定义,能够直接拿出来使用更加方便快捷!