引导页实现

然后邪恶哥就告诉我那玩意叫引导页,晓得术语后,我就自己百度去了,在code4app上找到了一份不错的demo。 也很方便。下面纪录下使用方法。

这里是code4app上的demo的下载链接。

http://code4app.com/ios/Introduction-Tutorial-View/5164359d6803fa8b1a000001


下载后,可以看看demo,很简单,我也是一看就懂。

下面说说我整合到我的项目中的方法。


1.把下载的demo中的

MYIntroductionView.h    

MYIntroductionView.m

MYIntroductionPanel.h

MYIntroductionPanel.m

这四个文件,再加上一些图像资源加到你的工程中去。(之后如果要修改图像等资源只要在相应位置修改就好了。这里只是师范,没做修改)。


2.在你的主界面(打开应用显示的第一个界面)

在对应的.h文件中引入头文件并且设置协议。

如我的是  mainView.h

[cpp]  view plain copy
  1. //  
  2. //  mainView.h  
  3. //  softwareApp  
  4. //  
  5. //  Created by 余龙泽 on 13-9-27.  
  6. //  Copyright (c) 2013年 余龙泽. All rights reserved.  
  7. //  
  8.   
  9. #import <UIKit/UIKit.h>  
  10. #import "MYIntroductionView.h"  
  11.   
  12. @interface mainView : UITabBarController<MYIntroductionDelegate>  
  13.   
  14. @end  


3.在主界面对应的.m文件中加入如下代码。

如我的mainView.m

[cpp]  view plain copy
  1. -(void)viewDidAppear:(BOOL)animated{  
  2.       
  3.     //读取沙盒数据  
  4.     NSUserDefaults * settings1 = [NSUserDefaults standardUserDefaults];  
  5.     NSString *key1 = [NSString stringWithFormat:@"is_first"];  
  6.     NSString *value = [settings1 objectForKey:key1];  
  7.     if (!value)  //如果没有数据  
  8.     {  
  9.         //STEP 1 Construct Panels  
  10.         MYIntroductionPanel *panel = [[MYIntroductionPanel alloc] initWithimage:[UIImage imageNamed:@"SampleImage1"] description:@"Welcome to MYIntroductionView, your 100 percent customizable interface for introductions and tutorials! Simply add a few classes to your project, and you are ready to go!"];  
  11.           
  12.         //You may also add in a title for each panel  
  13.         MYIntroductionPanel *panel2 = [[MYIntroductionPanel alloc] initWithimage:[UIImage imageNamed:@"SampleImage2"] title:@"Your Ticket!" description:@"MYIntroductionView is your ticket to a great tutorial or introduction!"];  
  14.           
  15.         //STEP 2 Create IntroductionView  
  16.           
  17.         /*A standard version*/  
  18.         //MYIntroductionView *introductionView = [[MYIntroductionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) headerImage:[UIImage imageNamed:@"SampleHeaderImage.png"] panels:@[panel, panel2]];  
  19.           
  20.           
  21.         /*A version with no header (ala "Path")*/  
  22.         //MYIntroductionView *introductionView = [[MYIntroductionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) panels:@[panel, panel2]];  
  23.           
  24.         /*A more customized version*/  
  25.         MYIntroductionView *introductionView = [[MYIntroductionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) headerText:@"MYIntroductionView" panels:@[panel, panel2] languageDirection:MYLanguageDirectionLeftToRight];  
  26.         [introductionView setBackgroundImage:[UIImage imageNamed:@"SampleBackground"]];  
  27.           
  28.           
  29.         //Set delegate to self for callbacks (optional)  
  30.         introductionView.delegate = self;  
  31.           
  32.         //STEP 3: Show introduction view  
  33.         [introductionView showInView:self.view];  
  34.           
  35.         //写入数据  
  36.         NSUserDefaults * setting = [NSUserDefaults standardUserDefaults];  
  37.         NSString * key = [NSString stringWithFormat:@"is_first"];  
  38.         [setting setObject:[NSString stringWithFormat:@"false"] forKey:key];  
  39.         [setting synchronize];  
  40.     }  
  41. }  


代码不难。

viewDidAppear是在视图即将显示时候调用的方法。 这里看头寻找沙盒中 is_first中是否有数据,如果没有,就说明是第一次运行程序,则显示引导页并且在沙盒对应位置写入数据。

如果有数据,就说明不是第一次运行,则跳过,不显示引导页。  


很简单的操作。当然有更好的方法,也有更好的类库,这只是我个人选择的方法罢了。


学习的路上,与君共勉。

资源下载链接为: https://pan.quark.cn/s/22ca96b7bd39 在当今的软件开发领域,自动化构建与发布是提升开发效率和项目质量的关键环节。Jenkins Pipeline作为一种强大的自动化工具,能够有效助力Java项目的快速构建、测试及部署。本文将详细介绍如何利用Jenkins Pipeline实现Java项目的自动化构建与发布。 Jenkins Pipeline简介 Jenkins Pipeline是运行在Jenkins上的一套工作流框架,它将原本分散在单个或多个节点上独立运行的任务串联起来,实现复杂流程的编排与可视化。它是Jenkins 2.X的核心特性之一,推动了Jenkins从持续集成(CI)向持续交付(CD)及DevOps的转变。 创建Pipeline项目 要使用Jenkins Pipeline自动化构建发布Java项目,首先需要创建Pipeline项目。具体步骤如下: 登录Jenkins,点击“新建项”,选择“Pipeline”。 输入项目名称和描述,点击“确定”。 在Pipeline脚本中定义项目字典、发版脚本和预发布脚本。 编写Pipeline脚本 Pipeline脚本是Jenkins Pipeline的核心,用于定义自动化构建和发布的流程。以下是一个简单的Pipeline脚本示例: 在上述脚本中,定义了四个阶段:Checkout、Build、Push package和Deploy/Rollback。每个阶段都可以根据实际需求进行配置和调整。 通过Jenkins Pipeline自动化构建发布Java项目,可以显著提升开发效率和项目质量。借助Pipeline,我们能够轻松实现自动化构建、测试和部署,从而提高项目的整体质量和可靠性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值