IOS開發(fā)代碼分享之獲取啟動(dòng)畫面圖片的string
本代碼支持 iPhone 6 以下. 支持 iPhone 及 iPad
+(NSString*)getLaunchImageName { NSArray* images= @[@"LaunchImage.png", @"LaunchImage@2x.png",@"LaunchImage-700@2x.png",@"LaunchImage-568h@2x.png",@"LaunchImage-700-568h@2x.png",@"LaunchImage-700-Portrait@2x~ipad.png",@"LaunchImage-Portrait@2x~ipad.png",@"LaunchImage-700-Portrait~ipad.png",@"LaunchImage-Portrait~ipad.png",@"LaunchImage-Landscape@2x~ipad.png",@"LaunchImage-700-Landscape@2x~ipad.png",@"LaunchImage-Landscape~ipad.png",@"LaunchImage-700-Landscape~ipad.png"]; UIImage *splashImage; if ([self isDeviceiPhone]) { if ([self isDeviceiPhone4] && [self isDeviceRetina]) { splashImage = [UIImage imageNamed:images[1]]; if (splashImage.size.width!=0) return images[1]; else return images[2]; } else if ([self isDeviceiPhone5]) { splashImage = [UIImage imageNamed:images[1]]; if (splashImage.size.width!=0) return images[3]; else return images[4]; } else return images[0]; //Non-retina iPhone } else if ([[UIDevice currentDevice] orientation]==UIDeviceOrientationPortrait || [[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown)//iPad Portrait { if ([self isDeviceRetina]) { splashImage = [UIImage imageNamed:images[5]]; if (splashImage.size.width!=0) return images[5]; else return images[6]; } else { splashImage = [UIImage imageNamed:images[7]]; if (splashImage.size.width!=0) return images[7]; else return images[8]; } } else { if ([self isDeviceRetina]) { splashImage = [UIImage imageNamed:images[9]]; if (splashImage.size.width!=0) return images[9]; else return images[10]; } else { splashImage = [UIImage imageNamed:images[11]]; if (splashImage.size.width!=0) return images[11]; else return images[12]; } } } +(BOOL)isDeviceiPhone { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { return TRUE; } return FALSE; } +(BOOL)isDeviceiPhone4 { if ([[UIScreen mainScreen] bounds].size.height==480) return TRUE; return FALSE; } +(BOOL)isDeviceRetina { if ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 2.0)) // Retina display { return TRUE; } else // non-Retina display { return FALSE; } } +(BOOL)isDeviceiPhone5 { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && [[UIScreen mainScreen] bounds].size.height>480) { return TRUE; } return FALSE; }
- 解決ios模擬器不能彈出鍵盤問(wèn)題的方法
- iOS應(yīng)用開發(fā)中監(jiān)聽鍵盤事件的代碼實(shí)例小結(jié)
- 總結(jié)IOS關(guān)閉鍵盤/退出鍵盤的五種方式
- 查看iOS Crash logs的方法
- iOS10適配之權(quán)限Crash問(wèn)題的完美解決方案
- iOS Crash文件分析方法匯總
- IOS實(shí)戰(zhàn)之自定義轉(zhuǎn)場(chǎng)動(dòng)畫詳解
- iOS創(chuàng)建與使用靜態(tài)庫(kù)
- IOS 打包靜態(tài)庫(kù)詳細(xì)介紹
- iOS開發(fā)筆記之鍵盤、靜態(tài)庫(kù)、動(dòng)畫和Crash定位
相關(guān)文章
全面解析iOS中同步請(qǐng)求、異步請(qǐng)求、GET請(qǐng)求、POST請(qǐng)求
通過(guò)本文給大家全面解析了iOS中同步請(qǐng)求、異步請(qǐng)求、GET請(qǐng)求、POST請(qǐng)求,非常不錯(cuò),具有參考借鑒價(jià)值,感興趣的朋友一起學(xué)習(xí)吧2016-08-08iOS實(shí)現(xiàn)兩個(gè)控制器之間數(shù)據(jù)的雙向傳遞
這篇文章主要為大家詳細(xì)介紹了iOS實(shí)現(xiàn)兩個(gè)控制器之間數(shù)據(jù)的雙向傳遞的相關(guān)資料,感興趣的小伙伴們可以參考一下2016-05-05iOS 11更新后及iPhone X推出后工程中遇到的問(wèn)題及適配方法
這篇文章主要介紹了iOS 11更新后及iPhone X推出后工程中遇到的問(wèn)題及適配,需要的朋友可以參考下2017-10-10IOS LaunchScreen設(shè)置啟動(dòng)圖片與啟動(dòng)頁(yè)停留時(shí)間詳解
這篇文章主要介紹了IOS LaunchScreen設(shè)置啟動(dòng)圖片與啟動(dòng)頁(yè)停留時(shí)間詳解的相關(guān)資料,需要的朋友可以參考下2017-02-02如何用IOS調(diào)用WebService(SOAP接口)
這篇文章主要介紹了如何用IOS調(diào)用WebService(SOAP接口),需要的朋友可以參考下2015-07-07iOS表情鍵盤的簡(jiǎn)單實(shí)現(xiàn)代碼
這篇文章主要為大家詳細(xì)介紹了iOS表情鍵盤的簡(jiǎn)單實(shí)現(xiàn)代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-03-03iOS中sqlite數(shù)據(jù)庫(kù)的原生用法
這篇文章主要為大家詳細(xì)介紹了iOS中sqlite數(shù)據(jù)庫(kù)的原生用法,sqlite數(shù)據(jù)庫(kù)相信各位早已耳聞,非常輕巧的一個(gè)數(shù)據(jù)庫(kù),數(shù)據(jù)庫(kù)僅一個(gè)文件,即建即用,感興趣的小伙伴們可以參考一下32016-05-05