Get app startup page picture _ios with IOS code

Source: Internet
Author: User
Tags reserved uikit

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.

Related Article

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.