First download animation

Source: Internet
Author: User

First download animation

#pragma mark to set the first start animation
NSString *info = [nsbundlemainbundle].infodictionary[@ "Cfbundleversion"];

[nsthreadsleepfortimeinterval:5.0f];

Create window
self.window= [[uiwindowalloc]init];self.window.backgroundcolor= [Uicolor

Whitecolor];
self.window.frame= [UIScreen

Mainscreen].bounds;

    • Get version number

    • NSString *key = @ "Cfbundleversion";

    • NSString *lastversion =[[nsuserdefaultsstandarduserdefaults]objectforkey:key];

NSString *currentversion = [Nsbundlemainbundle].infodictionary[key];

//
if ([Currentversionisequaltostring:lastversion]) {

Self.window.rootViewController =[[sptabbarcontroller alloc] init];
}else
{Self.window.rootviewcontroller=[[welcomeviewcontroller alloc] init];

[[Nsuserdefaultsstandarduserdefaults]setobject:currentversion Forkey:key];
[[Nsuserdefaultsstandarduserdefaults] synchronize];
// }

#import "WelcomeViewController.h" #import "SPTabBarController.h" #import "Define.h"
@interface Welcomeviewcontroller ()

@property (nonatomic, strong) Uiscrollview*welcome;
@property (nonatomic, strong) Uiimageview*next;

@end

@implementation Welcomeviewcontroller

-(void) viewdidload {[Super viewdidload];

Self.welcome = [[Uiscrollview alloc]init];

Self.welcome.frame = [Uiscreenmainscreen].bounds;

Self.welcome.contentSize = Cgsizemake (Kscreenwidth, kscreenheight);

Self.welcome.pagingenabled=yes;

Self.welcome.showshorizontalscrollindicator=no;

Self.welcome.showsverticalscrollindicator=no;

Self.welcome.bounces=no;

for (int i=1; i < 3 + 1; i++) {uiimageview*

Imageview=[[uiimageview Alloc]init]; CGFloat ImageX = (i-1) *

Kscreenwidth;
CGFloat imagey = 0;

Imageview.frame=cgrectmake (Imagex,imagey, Kscreenwidth, kscreenheight);

Imageview.image=[uiimageimagenamed:[nsstring

stringwithformat:@ "%d", I]]; [Self.welcome

addsubview:imageview];/**

* Add a button to the homepage at the last picture

*/
if (i = = 3) {

[Selfsetuplastimageview:imageview];

}}

[Self.view addSubview:self.welcome];}

-(void) Setuplastimageview: (uiimageview*) ImageView

{
To add a button on ImageView, you need to turn on user interaction

Can, Uiimageview this function by default off Imageview.userinteractionenabled=yes;

uibutton* Btn=[[uibutton Alloc]init];

Btn.frame=cgrectmake (0, 0, kscreenwidth,kscreenheight);

[Btn addtarget:selfaction: @selector (jumpmainpage) forcontrolevents:uicontroleventtouchupinside];

[ImageView addsubview:btn];}

-(void) Jumpmainpage {

uiwindow* window =[uiapplicationsharedapplication].keywindow;

Window.rootviewcontroller=[[sptabbarcontroller Alloc]init];
}

-(void) didreceivememorywarning {[Super didreceivememorywarning];

}

First download animation

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.