The first time the installation will have a guide page to display the first time directly into the application page
if ([[[[Nsuserdefaults Standarduserdefaults] objectforkey:@ "Isone"] isequal:@ "Isone"]) {
[Self showviewcontroller];
}else{
Rootviewcontroller *root= [[Rootviewcontroller alloc] init];
Self.window.rootViewController = root;
[Self isfirstinstall];
}
Write the method directly in the Appdelegate class
-(void) isfirstinstall{
Guide page
Uiscrollview *SC = [[Uiscrollview alloc]initwithframe:self.window.bounds];
sc.pagingenabled = YES;
Sc.delegate = self;
Sc.showshorizontalscrollindicator = NO;
Sc.showsverticalscrollindicator = NO;
[Self.window.rootViewController.view ADDSUBVIEW:SC];
Nsarray *arr = @[@ "Boot page 1.jpg" @ "boot page 2.jpg" @ "boot page 3.jpg"];
for (Nsinteger i = 0; i<arr.count; i++)
{
Uiimageview *img = [[Uiimageview alloc]initwithframe:cgrectmake (screen_width*i, 0, Screen_width, Self.window.frame.size.height)];
Img.image = [UIImage imagenamed:arr[i]];
[SC addsubview:img];
img.userinteractionenabled = YES;
if (i = = arr.count-1)
{
Set the last Page Experience button based on the requirements in your project
UIButton *btn = [UIButton buttonwithtype:uibuttontyperoundedrect];
Btn.frame = CGRectMake ((SELF.WINDOW.FRAME.SIZE.WIDTH/2) -100, screen_height-110, 200, 50);
Btn.backgroundcolor = [Uicolor Greencolor];
[Btn settitle:@ "Start experience" forstate:uicontrolstatenormal];
[Btn addtarget:self Action: @selector (Goroot) forcontrolevents:uicontroleventtouchupinside];
[img ADDSUBVIEW:BTN];
[btn Settitlecolor:[uicolor Whitecolor] forstate:uicontrolstatenormal];
Btn.layer.borderWidth = 1;
Btn.layer.borderColor = [Uicolor Greencolor]. Cgcolor;
}
}
Sc.contentsize = Cgsizemake (Screen_width*arr.count, self.window.frame.size.height);
}
How to do it now
-(void) goroot{
Nsuserdefaults *user = [Nsuserdefaults standarduserdefaults];
[User setobject:@ "Isone" forkey:@ "Isone"];
[User Synchronize];
Set the root controller in the project here
Self.window.rootviewController = Viewcontroller;
}
The ScrollView proxy method Settings Guide page in the project
-(void) Scrollviewdidscroll: (Uiscrollview *) ScrollView
{
Screen_width 4 is the number of guide pages, x offset is greater than 4 screen more than 30, can also enter the application, similar to the immediate experience in the functional method. Add based on requirements in your project
if (Scrollview.contentoffset.x>screen_width *4+30)
{
[Self goroot];
}
}
is so easy, guide diagram set up, mutual encouragement
IOS One method first install rolling diagram Show app Introduction