zoukankan      html  css  js  c++  java
  • UITableViewCell 分割线如何满屏

    在iOS7中,UITableViewCell左侧会有默认15像素的空白。设置setSeparatorInset:UIEdgeInsetsZero 能将空白去掉。

    但是在iOS8中,设置setSeparatorInset:UIEdgeInsetsZero 已经不起作用了。下面是解决办法

    在UITableView的代理方法中加入以下代码 

     1 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
     2 
     3 {
     4 
     5     if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
     6 
     7         [cell setSeparatorInset:UIEdgeInsetsZero];
     8 
     9     }
    10 
    11     if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
    12 
    13         [cell setLayoutMargins:UIEdgeInsetsZero];
    14 
    15     }
    16 
    17 }    
  • 相关阅读:
    bzoj2161 布娃娃
    bzoj2161 布娃娃
    Tyvj1054
    Tyvj1054
    Tyvj1053
    Tyvj1053
    hdu3265 Poster(扫描线)
    hdu3265 Poster(扫描线)
    hdu3265(好题翻译)
    hdu3265(好题翻译)
  • 原文地址:https://www.cnblogs.com/qq744890760/p/5127264.html
Copyright © 2011-2022 走看看