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