Layout without header background
Layout with header background so you can see its centered
我试图让标题看起来在设计中居中,但由于单元格中的顶部空间,它看起来已经被置于高处。如何让它出现在所有屏幕尺寸上?我担心如果我使用点数偏移它会在大屏幕上偏移太小而在小屏幕上偏移很大?
目前我这样做:
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
}