IOS One method first install rolling diagram Show app Introduction

Source: Internet
Author: User

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

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.