• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
人生如_梦
博客园    首页    新随笔    联系   管理    订阅  订阅
UITableViewCell 顶格
  1. 首先在ViewDidLoad 或者ViewWillAppear里边写
     1 if ([_tabView respondsToSelector:@selector(setSeparatorInset:)]) {
     2         
     3         [_tabView setSeparatorInset:UIEdgeInsetsZero];
     4         
     5     }
     6     if ([_tabView respondsToSelector:@selector(setLayoutMargins:)]) {
     7         
     8         [_tabView setLayoutMargins:UIEdgeInsetsZero];
     9         
    10     }

     

  2. 然后在cellForRowIndexPath或者是Display里边加上
     1 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
     2     
     3     
     4     if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
     5         
     6         [cell setSeparatorInset:UIEdgeInsetsZero];
     7         
     8     }
     9     
    10     if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
    11         
    12         [cell setLayoutMargins:UIEdgeInsetsZero];
    13     }
    14     
    15     
    16     
    17     
    18 }

    之后 cell 下边的 线条就可以顶格了

posted on 2015-04-21 10:52  人生如_梦  阅读(226)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3