Iphone X has a black band on top.
It can cover some view
at top, so we need to put down all views some space.
Here is technique
parameter.
The black band height
30pt, we know iphone X screen size is 375x812, create a variable name xle=0 and use if command.
let c = UIScreen.mainScreen().bounds.size.height
Or
let c = view.frame.size.height
if c==812{
xle = 30
}
When set
postion for label, we use.
label = UILabel(frame: CGRect(x: 0, y: 15+xle, width: 320, height: 40))
Now when run iphone X
label will move down 30pt.
We can also use c>800, devices with screen height bigger than 800 contain
iphone X and ipad, the gap 30pt is nothing with their
height, can’t affect to user interface.
No comments:
Post a Comment