iOS 8下设置cell的分割线缩进separatorInset
2016-12-16 15:56
417 查看
iOS 8下设置cell的分割线缩进separatorInset,这个属性是IOS7后才有的属性,所以需要判断一下,才能修改 ,7.0以前,是占满的,不用修改。
-(void)viewDidLayoutSubviews
{
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
}
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
-(void)viewDidLayoutSubviews
{
if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
}
if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
}
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
相关文章推荐
- iOS 8下设置cell的分割线缩进separatorInset
- iOS - IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- iOS 设置TableView Separatorinset 分割线从边框顶端开始以及分割线的颜色
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- iOS8 UITableViewCell设置 setSeparatorInset:UIEdgeInsetsZero不起作用的解决办法
- iOS7 tableview separatorInset cell分割线左对
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- iOS8 tableview separatorInset cell分割线左对齐,ios7的方法失效了
- iOS7 tableview separatorInset cell分割线左对齐
- iOS7 tableview separatorInset cell分割线左对齐
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始 (这个和我之前的有点区别)
- iOS开发笔记——TableView Separatorinset 分割线从边框顶端开始
- iOS8 tableview separatorInset cell分割线左对齐,ios7的方法失效了
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始
- IOS8 设置TableView Separatorinset 分割线从边框顶端开始