美文网首页
UITableView你不常用但能让你的视图好看不少的属性

UITableView你不常用但能让你的视图好看不少的属性

作者: hoggenWang | 来源:发表于2016-03-21 20:50 被阅读97次

1.不知道你有没有注意到cell的分割线和视图左边是有一定距离的,对的,这是属性是可以设置的:

mTableView.separatorInset=UIEdgeInsetsMake(0, 0, 0, 0);

2.有时候我们并不希望tableview有弹跳效果

mTableView.bounces=NO;

3.如果我希望tableview看起来更像一个模块怎么办了?当然是给他打上边框

mTableView.layer.borderWidth=1;

4.我不想没有内容的cell也显示出来

[mTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

有些属性或方法我们是不常用,但用好了也会让你的视图与众不同


//头宽
- (CGFloat)tableView: (UITableView *)tableView
heightForHeaderInSection: (NSInteger)section
{
    
    return 0;
}
//脚宽
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0;
}
//头视图
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    return nil;
}
//视图
-(UIView*) tableView: (UITableView*)tableView
viewForFooterInSection: (NSInteger)section
{
    return nil;
}

相关文章

网友评论

      本文标题:UITableView你不常用但能让你的视图好看不少的属性

      本文链接:https://www.haomeiwen.com/subject/aqgklttx.html