【发布时间】:2015-10-29 13:52:50
【问题描述】:
我有一些 UITableView 和 UILabel 在它的标题。它在 iPhone 上看起来很完美:
Screenshot of iPhone
但在 iPad 上,我在 UISplitViewController 的大师中展示了这个视图,而我的标题没有文字!这还不是问题的全部。查看单元格分隔符。为什么它们从视图的中间开始?
Screenshot of iPad
标签约束:
UIView *headerView = [[UIView alloc] initWithFrame:
CGRectMake(0, 0, self.tableView.frame.size.width, PCHeaderHeight)];
[headerView addSubview:oldMessages];
NSDictionary *views = @{@"label": oldMessages};
[headerView addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat:@"H:|-[label]-|"
options:NSLayoutFormatAlignAllCenterX
metrics:nil
views:views]];
[headerView addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat:@"V:|-[label]-|"
options:NSLayoutFormatAlignAllCenterY
metrics:nil
views:views]];
【问题讨论】:
-
你的
UILabel有什么限制? -
顺便说一下,View Debugger 在正确的位置显示所有内容。
标签: ios objective-c iphone uitableview ipad