Created
January 6, 2016 14:42
-
-
Save iangmaia/e7f6b09da2a7ae80b4c5 to your computer and use it in GitHub Desktop.
Get Launch Screen Image Name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static private func splashImageForOrientation() -> String { | |
let viewSize = UIScreen.mainScreen().bounds.size | |
let viewOrientation = "Portrait" | |
let imagesDict = NSBundle.mainBundle().infoDictionary as Dictionary<NSObject, AnyObject>! | |
let imagesArray = imagesDict["UILaunchImages"] as! NSArray | |
for dict in imagesArray { | |
let dictNSDict = dict as! NSDictionary | |
let imageSize = CGSizeFromString(dictNSDict["UILaunchImageSize"] as! String) | |
if CGSizeEqualToSize(imageSize, viewSize) && viewOrientation == (dictNSDict["UILaunchImageOrientation"] as! String) { | |
return dictNSDict["UILaunchImageName"] as! String | |
} | |
} | |
return "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment