Get the App launch page picture in code

Source: Internet
Author: User

Get the App launch page picture in code

Source- Swift

////Applesystemservice.swift//swift-animations////Created by youxianming on 16/8/11.//copyright©2016 year youxianming. All rights reserved.//Import UIKitclassApplesystemservice:nsobject {/** Get the lauch image.     -Returns:the lauch image. */    classFunc launchimage ()UIImage {var lauchimage:uiimage!var vieworientation:string!Let viewsize=Uiscreen.mainscreen (). Bounds.size Let orientation=uiapplication.sharedapplication (). StatusbarorientationifOrientation = =. Landscapeleft | | Orientation = = . landscaperight {vieworientation="Landscape"                    } Else{vieworientation="Portrait"} let Imagesinfoarray= Nsbundle.mainbundle (). infodictionary! ["uilaunchimages"]         forDict:dictionary <string, string>inchImagesinfoarray as!Array {Let imageSize= Cgsizefromstring (dict["uilaunchimagesize"]!)            ifCgsizeequaltosize (ImageSize, viewsize) && vieworientation = = dict["uilaunchimageorientation"]! asString {lauchimage= UIImage (named:dict["Uilaunchimagename"]!)            }        }                returnLauchimage}}

Source code- objective-c

////AppleSystemService.h//Applesystemservice////Created by youxianming on 16/7/2.//copyright©2016 year youxianming. All rights reserved.//#import<Foundation/Foundation.h>#import<UIKit/UIKit.h>@interfaceApplesystemservice:nsobject/** Get the lauch image. * * @return the lauch image.*/+ (UIImage *) Launchimage;@end
////APPLESYSTEMSERVICE.M//Applesystemservice////Created by youxianming on 16/7/2.//copyright©2016 year youxianming. All rights reserved.//#import "AppleSystemService.h"@implementationApplesystemservice+ (UIImage *) launchimage {UIImage*lauchimage =Nil; NSString*vieworientation =Nil; Cgsize viewsize=[UIScreen mainscreen].bounds.size; Uiinterfaceorientation Orientation=[[UIApplication sharedapplication] statusbarorientation]; if(Orientation = = Uiinterfaceorientationlandscapeleft | | orientation = =uiinterfaceorientationlandscaperight) {vieworientation=@"Landscape"; } Else{vieworientation=@"Portrait"; } Nsarray*imagesdictionary = [[[NSBundle Mainbundle] infodictionary] Valueforkey:@"uilaunchimages"];  for(Nsdictionary *dictinchimagesdictionary) {cgsize imageSize= Cgsizefromstring (dict[@"uilaunchimagesize"]); if(Cgsizeequaltosize (ImageSize, viewsize) && [Vieworientation isequaltostring:dict[@"uilaunchimageorientation"]]) {lauchimage= [UIImage imagenamed:dict[@"Uilaunchimagename"]]; }    }    returnlauchimage;}@end

Get the App launch page picture in code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.