Ios 在两个标签之间创建距离约束
我正在uitableviewcell上渲染两个标签。我想增加他们之间的距离。 这是我的代码:Ios 在两个标签之间创建距离约束,ios,objective-c,autolayout,Ios,Objective C,Autolayout,我正在uitableviewcell上渲染两个标签。我想增加他们之间的距离。 这是我的代码: - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *values = self.viewModel.dataSet[indexPath.row]; NSString
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *values = self.viewModel.dataSet[indexPath.row];
NSString *key = values.allKeys.firstObject;
id value = values[key];
[NSLayoutConstraint constraintWithItem: cell.textLabel attribute: NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual toItem: cell.detailTextLabel
attribute: NSLayoutAttributeTop multiplier:1.0 constant:20.0];
.....
然而,它们似乎没有移动
有人能帮我吗?我不太熟悉通过代码创建约束。添加约束后,请尝试[cell LayoutifNeed],不要仅使用UITableViewCell创建带有自己标签的自定义子类,因为您将无法轻松或很好地更改UITableViewCell视图。