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

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;
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容