ios - SpriteKit - How do I handle multiple screen sizes? -
my new game finished , i'm testing on multiple real devices. came across multiple issues after testing. big issue how handle screen sizes. game how want on 6 plus/6s plus, not on 6s, 6, 5s, 5, 4s, 4, or ipad.
i found these 2 answers don't know how implement them: how support multiple screen sizes in spritekit? , spritekit how correct screen size
i type of help, because irritating me.
i reminded of checking screen size , changing node sizes, found answer: how check screen size of iphone 4 , iphone 5 programmatically in swift
all had add in gamescene , called in every .swift:
extension uiscreen { enum sizetype: cgfloat { case unknown = 0.0 case iphone4 = 960.0 case iphone5 = 1136.0 case iphone6 = 1334.0 case iphone6plus = 1920.0 } var sizetype: sizetype { let height = nativebounds.height guard let sizetype = sizetype(rawvalue: height) else { return .unknown } return sizetype } }
and this
if uiscreen.mainscreen().sizetype == .iphone4 { // make specific layout small devices. }
Comments
Post a Comment