我试图使页眉在设计中居中显示,但是由于单元格中的顶部空间,它看起来一直很高。如何使它出现在所有屏幕尺寸上?我担心如果我使用偏移量来表示它在大屏幕上的偏移量太小而在小屏幕上的偏移量太大了?
目前我这样做是这样的:
func adjustLayoutToFrame(){
let screenSize = UIScreen.main.bounds
let screenHeight = screenSize.height
let cellHeight = screenHeight / 9
let headerHeight = cellHeight*2
weekHeaderLabel.frame.size.height = headerHeight
print("header height set to:", headerHeight)
cellHeightForDevice = cellHeight
//weekHeaderLabel.backgroundColor = .blue
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句