xcode - Is it possible to define different background image for each ios device? -
for example, set background of iphone 5 image1 , background of iphone 6 image2, , third different image iphone 6+
how can achieve using interface builder
programmatically (this assumes portrait only):
enum device { case iphone5 case iphone6 case iphone6p static var sizeclass: device { let screenwidth = uiscreen.mainscreen().bounds.width switch screenwidth { case _ screenwidth < 375: return .iphone5 case 414: return iphone6p default: return .iphone6 } } }
then set image:
switch device.sizeclass { case .iphone5: // set image case .iphone6: // set image case .iphone6p: // set image }
Comments
Post a Comment