【问题标题】:UITableView's separators and header strange behavior iOS9 onlyUITableView 的分隔符和标题奇怪的行为 iOS9 而已
【发布时间】: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


【解决方案1】:

这个效果只在模拟器中,测试一个设备很可能就是这个标准。(个人经验)

【讨论】:

  • 我尝试在连接的 iPad 上从 Xcode 运行它,但出现了同样的问题。
【解决方案2】:

好吧,我的错误是我在继承自UISplitViewController 的视图控制器中错过了[super viewWillAppear]。 谢谢。

【讨论】:

    猜你喜欢
    • 2014-04-30
    • 2015-10-04
    • 2014-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-06
    • 1970-01-01
    相关资源
    最近更新 更多