我正在调整表头的大小,这是表中的一个视图,名为detailedInterestTableView。此方法放置在(void)viewDidLayoutSubviews方法中。当从iPhone 6或iPhone 6+运行时,这是可行的。当它在我的iPhone 5上运行时,这段代码根本不影响UI,表头保持不变。
此代码是否仅适用于某些设备(iPhone 6及更高版本)?是什么使我的iPhone 5与iPhone 6和iPhone 6+看起来不同呢?它们都运行在9.2版上。
-(void)viewDidLayoutSubviews{
CGRect newFrame = self.detailedInterestTableView.tableHeaderView.frame;
newFrame.size.height = newFrame.size.height-92;
self.detailedInterestTableView.tableHeaderView.frame = newFrame;
[self.detailedInterestTableView setTableHeaderView:self.detailedInterestTableView.tableHeaderView];
}iPhone 6/6+。照片下面的空白(包含类似/不喜欢/注释按钮)是正确的:

iPhone5。照片下面的空白处(它持有/不喜欢/注释按钮)是不正确的。它太大了。

发布于 2015-12-10 00:32:12
您正在使用一个相对更改来修改帧高:-92
因此,如果最初的框架不是相同的,结果也会有所不同。尝试使用固定值。
试着替换
newFrame.size.height = newFrame.size.height-92;通过
newFrame.size.height = 500; // Or any other value that fitshttps://stackoverflow.com/questions/34191551
复制相似问题