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;
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