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"];
}
文件

相關文章
相關標籤/搜索