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

2016-03-21  本文已影响97人  hoggenWang

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;
}
上一篇 下一篇

猜你喜欢

热点阅读