• IOS7 8中tableview分割线缺少15像素


    IOS8 设置TableView Separatorinset 分割线从边框顶端开始

    在ios8上 [TableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];不起作用

    经过测试加入下面方法 在ios7 8上都可以正常工作

    1. -(void)viewDidLayoutSubviews  
    2. {  
    3.     if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {  
    4.         [self.tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];  
    5.     }  
    6.       
    7.     if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) {  
    8.         [self.tableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];  
    9.     }  
    10. }  
    11.   
    12. -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath  
    13. {  
    14.     if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {  
    15.         [cell setSeparatorInset:UIEdgeInsetsZero];  
    16.     }  
    17.       
    18.     if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {  
    19.         [cell setLayoutMargins:UIEdgeInsetsZero];  
    20.     }  
    21. }  

    对于多余的横线,如果显示不到全屏,会出现横线。

    只需要设置为 

    UITableViewStyleGrouped

  • 相关阅读:
    mysql基于Altas读写分离并实现高可用
    mysql基于GTIDS复制
    mysql创建用户账号出错
    mysql存储引擎
    mysql读写分离
    for each ;for in;for of 三者的区别
    关于编程的历史
    用indexof来统计字符出现的次数
    正则表达式
    DOM,BOM
  • 原文地址:https://www.cnblogs.com/sunnyke/p/4664444.html
Copyright © 2020-2023  润新知