import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. var label = "1" //获取屏幕大小 let iOSDeviceScreenSize: CGSize = UIScreen.main.bounds.size NSLog("%@ x %@", iOSDeviceScreenSize.width, iOSDeviceScreenSize.height) var s : NSString = NSString(format: "%@ x %@",iOSDeviceScreenSize.width,iOSDeviceScreenSize.height) label = s as String //获取设备信息,判断是否为iphone if (UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone) { //判断是否为竖屏 if (iOSDeviceScreenSize.height >