繁体   English   中英

在编辑器->固定中禁用了约束

[英]Constraints disabled in Editor -> Pin

我正在尝试使用情节提要在UITableView上设置约束。 编辑器->固定选项中,约束被禁用。

在此处输入图片说明

为什么不启用它们?

更新 :Gabbler的观察正确地指出tableView是最顶层的视图,您无需对其进行pin操作 我设置约束的目的是使tableView的引导空间无效,这在应用程序运行时默认出现。 请检查屏幕截图:

在此处输入图片说明

您正在寻找的是separatorInsetlayoutMargins viewDidLoad

self.tableView.layoutMargins = UIEdgeInsetsZero;
self.tableView.separatorInset = UIEdgeInsetsZero;

并添加此方法。

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell     forRowAtIndexPath:(NSIndexPath *)indexPath{

    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM