Advertisement
Guest User

Untitled

a guest
May 27th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. func imageNameForBackground() -> String!
  2. {
  3. var viewSize = UIScreen.mainScreen().bounds.size;
  4. var viewOrientation = "Portrait";
  5. if UIDevice.currentDevice().orientation.isLandscape
  6. {
  7. viewSize = CGSizeMake(viewSize.height, viewSize.width);
  8. viewOrientation = "Landscape";
  9. }
  10.  
  11. let imagesDict = NSBundle.mainBundle().infoDictionary!["UILaunchImages"] as! NSArray
  12. for dict in imagesDict
  13. {
  14. let dictionary = dict as! NSDictionary
  15. let imageSize = CGSizeFromString(dict["UILaunchImageSize"] as! String)
  16.  
  17. if CGSizeEqualToSize(imageSize, viewSize) && viewOrientation == (dictionary["UILaunchImageOrientation"] as! String)
  18. {
  19. return dictionary["UILaunchImageName"] as! String
  20. }
  21. }
  22.  
  23. return nil
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement