Use code to get app startup page picture
Applesystemservice.swift//Swift-animations////Created by youxianming on 16/8/11. COPYRIGHT©2016 year youxianming.
All rights reserved.
Import Uikit class Applesystemservice:nsobject {/** get the lauch image.
-Returns:the lauch image.
*/class Func launchimage ()-> UIImage {var lauchimage:uiimage!
var vieworientation:string! Let viewsize = Uiscreen.mainscreen (). bounds.size Let orientation = uiapplication.sharedapplication (). StatusBarOrienta tion if orientation = =. Landscapeleft | | Orientation = =. landscaperight {vieworientation = "Landscape"} else {vieworientation = "portrait"} Let Imag Esinfoarray = Nsbundle.mainbundle (). infodictionary! ["Uilaunchimages"] for dict:dictionary <string, string> in Imagesinfoarray as!
Array {Let imagesize = cgsizefromstring (dict["Uilaunchimagesize"]!) If Cgsizeequaltosize (ImageSize, viewsize) && vieworientation = = dict["UilaunchimageorienTation "]!
As String {lauchimage = UIImage (named:dict["Uilaunchimagename"]!)
}} return Lauchimage}}
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> @interface applesystemservice: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" @implementation Applesystemservice + (UIImage *) launchimage {uiimage *lauchimag
e = nil;
NSString *vieworientation = nil;
Cgsize viewsize = [UIScreen mainscreen].bounds.size;
uiinterfaceorientation orientation = [[UIApplication sharedapplication] statusbarorientation]; if (orientation = = Uiinterfaceorientationlandscapeleft | | orientation = = uiinterfaceorientationlandscaperight) {view
Orientation = @ "Landscape"; } else {VIeworientation = @ "Portrait";
} Nsarray *imagesdictionary = [[[NSBundle Mainbundle] infodictionary] valueforkey:@ "Uilaunchimages"];
For (Nsdictionary *dict in imagesdictionary) {cgsize imagesize = cgsizefromstring (dict[@ "uilaunchimagesize"]); if (Cgsizeequaltosize (ImageSize, viewsize) && [vieworientation isequaltostring:dict[@]
Uilaunchimageorientation "]) {lauchimage = [uiimage imagenamed:dict[@" Uilaunchimagename "]];
} return lauchimage;
} @end
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.