Iphone 屏幕适配

#define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES) spa


经过上面这行代码你能够知道程序如今是否运行在大尺寸屏幕中。代码实际上就是经过当前屏幕的尺寸,减去iPhone 5的屏幕尺寸,若是结果是0,那么说明设备是iPhone 5。 程序

下面在 IODViewController.m文件中使用这个宏。 将以下代码添加到viewWillAppear:最后: im

if (IS_IPHONE5) {
    self.ibBackgroundImage.image = [UIImage imageNamed:@"bg_wall-568h.png"];
    self.ibCounter.image = [UIImage imageNamed:@"bg_counter-568h.png"];
}
文件