温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

iOS UITableView中系统分隔线的使用

发布时间:2020-07-16 12:53:43 来源:网络 阅读:461 作者:大头狼小鬼 栏目:移动开发
//设置分割线的左右对齐
   if([_myTableView respondsToSelector:@selector(setSeparatorInset:)]){
       [_myTableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
    }
//设置分割线的颜色
   if([_myTableView respondsToSelector:@selector(setSeparatorColor:)]){
       [_myTableView setSeparatorColor:[UIColor grayColor]];
     }
//隐藏分割线
       _myTableView.separatorStyle = NO;
//去掉多余的分割线 
      _myTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
#pragma mark-once 分割线 8.0以下的方法
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [tableView setSeparatorInset:UIEdgeInsetsZero];
    }
    
    if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [tableView setLayoutMargins:UIEdgeInsetsZero];
    }
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}

今天复习了下UITableVie分割线的用法,看了设置分割线毛玻璃的效果,发现并没有明显突出的亮点,只是变模糊了,改颜色也没有啥用。

基本分割线很常用,随着系统的升级有些方法不兼容,要我时常兼容之前的版本,基本都是系统的或者就是自定义定义一个UIView设置1px这样做。


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI