IOS Settings Launchimage Animations

Source: Internet
Author: User

Launchimage disappears immediately after the app is initialized and displays the app's interface, but sometimes we don't want it to disappear so quickly (for example, some people want to have a transition effect some people want to wait for certain settings or data to disappear after loading), which is also very simple, We just have to show the launchimage again and the top is OK.

But we've configured so many launchimage for different screen resolutions how do we get launchimage for the current screen resolution?

The common approach is to add all launchimage to the project and name it according to the screen resolution (640_960.png 640_1136.png ...) and then use the code in the program to stitch up the corresponding file name and reference

But this method is relatively primitive and in case the apple out of some other resolution of the device or the start diagram changes when the need to manually modify the project configuration is not very good and need more than a share of resources (the app's capacity has become larger)

And Stackflow on the Cherpak Evgeny share a better way to directly read the settings in NSBundle to get the current applicable launchimage

I've written a demo code with the diagram above as an example:

Cgsize viewsize = self.window.bounds.size;

NSString *vieworientation = @ "Portrait"; Horizontal screen please set to @ "Landscape"

NSString *launchimage = nil;

nsarray* imagesdict = [[[NSBundle Mainbundle] infodictionary] valueforkey:@ "Uilaunchimages"];

For (nsdictionary* dict in imagesdict)

{

Cgsize imageSize = cgsizefromstring (dict[@ "uilaunchimagesize"]);

if (Cgsizeequaltosize (ImageSize, viewsize) && [vieworientation isequaltostring:dict[@] Uilaunchimageorientation "])

{

Launchimage = dict[@ "Uilaunchimagename"];

}

}

Uiimageview *launchview = [[Uiimageview alloc] initwithimage:[uiimage imagenamed:@ "Launchimage"];

Launchview.frame = Self.window.bounds;

Launchview.contentmode = Uiviewcontentmodescaleaspectfill;

[Self.window Addsubview:launchview];

[UIView animatewithduration:1.0f

delay:0.5f

Options:uiviewanimationoptionbeginfromcurrentstate

animations:^{

Launchview.alpha = 0.0f;

LaunchView.layer.transform = Catransform3dscale (catransform3didentity, 1.2, 1.2, 1);

}

completion:^ (BOOL finished) {

[Launchview Removefromsuperview];

}];

IOS Settings Launchimage Animations

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.