ios开发-引导页实现
源码:http://files.cnblogs.com/ios8/%5Bcode4app.com%5DIntroductionTutorialView_10843.zip
可以看看demo,很简单,我也是一看就懂。
下面说说我整合到我的项目中的方法。
1.把下载的demo中的
MYIntroductionView.h
MYIntroductionView.m
MYIntroductionPanel.h
MYIntroductionPanel.m
这四个文件,再加上一些图像资源加到你的工程中去。(之后如果要修改图像等资源只要在相应位置修改就好了。这里只是师范,没做修改)。
2.在你的主界面(打开应用显示的第一个界面)
在对应的.h文件中引入头文件并且设置协议。
如我的是 mainView.h
- //
- // mainView.h
- // softwareApp
- //
- // Created by 余龙泽 on 13-9-27.
- // Copyright (c) 2013年 余龙泽. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- #import "MYIntroductionView.h"
- @interface mainView : UITabBarController<MYIntroductionDelegate>
- @end
3.在主界面对应的.m文件中加入如下代码。
如我的mainView.m
- -(void)viewDidAppear:(BOOL)animated{
- //读取沙盒数据
- NSUserDefaults * settings1 = [NSUserDefaults standardUserDefaults];
- NSString *key1 = [NSString stringWithFormat:@"is_first"];
- NSString *value = [settings1 objectForKey:key1];
- if (!value) //如果没有数据
- {
- //STEP 1 Construct Panels
- 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!"];
- //You may also add in a title for each panel
- MYIntroductionPanel *panel2 = [[MYIntroductionPanel alloc] initWithimage:[UIImage imageNamed:@"SampleImage2"] title:@"Your Ticket!" description:@"MYIntroductionView is your ticket to a great tutorial or introduction!"];
- //STEP 2 Create IntroductionView
- /*A standard version*/
- //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]];
- /*A version with no header (ala "Path")*/
- //MYIntroductionView *introductionView = [[MYIntroductionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) panels:@[panel, panel2]];
- /*A more customized version*/
- 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];
- [introductionView setBackgroundImage:[UIImage imageNamed:@"SampleBackground"]];
- //Set delegate to self for callbacks (optional)
- introductionView.delegate = self;
- //STEP 3: Show introduction view
- [introductionView showInView:self.view];
- //写入数据
- NSUserDefaults * setting = [NSUserDefaults standardUserDefaults];
- NSString * key = [NSString stringWithFormat:@"is_first"];
- [setting setObject:[NSString stringWithFormat:@"false"] forKey:key];
- [setting synchronize];
- }
- }
代码不难。
viewDidAppear是在视图即将显示时候调用的方法。 这里看头寻找沙盒中 is_first中是否有数据,如果没有,就说明是第一次运行程序,则显示引导页并且在沙盒对应位置写入数据。
如果有数据,就说明不是第一次运行,则跳过,不显示引导页。
很简单的操作。当然有更好的方法,也有更好的类库,这只是我个人选择的方法罢了。
ios开发-引导页实现的更多相关文章
- iOS App引导页功能实现
一.写作原因 以前都没有想着来写点东西,今天遇到件事情让我决定每次还是要做记录.因为以前自己可以轻松的完成pod spec的配置,但是今天在做的时候还是忘了遇到了很多坑.pod spec配置遇到的坑不 ...
- [iOS] App引导页的简单实现 (Swift 2)
转载请注明出处:http://www.jianshu.com/p/024dd2d6e6e6# 已更新至 Xcode7.2.Swift2.1 在第一次打开App或者App更新后通常用引导页来展示产品特性 ...
- iOS:判断引导页首次出现、版本更新
判断引导页首次出现方式: //选择根控制器 +(void)chooseRootViewController{ //初始化Window窗口 [AppDelegate Delegate].window = ...
- iOS透明引导页
一.效果展示 这里写图片描述 这种类型的新手引导比较常见,用于告诉用户某个按钮的作用,或者提醒用户可以进行某种交互操作.引导样式是在界面上加了一个半透明的引导图,高亮部分就是要突出的区域 二.怎么做? ...
- Sagit.Framework For IOS 开发框架入门开发教程2:一行代码实现引导页
前言: 开篇比较简单:Sagit.Framework For IOS 开发框架入门开发教程1:框架下载与环境配置 第二篇教程之前写了一半,感觉不太好写,而且内容单纯介绍API,要说的很多,又枯燥乏味. ...
- 用Flutter开发的跨平台项目,完美运行在Android和IOS上,Material简洁风格,包括启动页、引导页、注册、登录、首页、体系、公众号、导航、项目,还有漂亮的妹子图库,运行极度流畅,结构清晰,代码规范,值得拥有
Flutter学习资源汇总持续更新中...... Flutter官方网站 Flutter中文网 wendux的Flutter实战 Flutter官方exampleflutter_gallery 阿里巴 ...
- iOS开发笔记(Swift)-通用App安装引导页的实现
之前一直做的项目都是基于OC开发的,最近开始尝试使用Swift语言来重写整个项目. 本篇文章主要是讲述如何使用Swift来实现常见的通用App安装引导界面. 效果预览: 实现思路: 主要是采用了UIS ...
- IOS开发小功能1:引导页的开发
效果图如上,实现的是一个页面引导页,最后跳到主页面,主页面是一个navigationController,但是导航栏给我隐藏了. 文件目录:自己定制的viewcontroller以及navigatio ...
- iOS - GitHub干货分享(APP引导页的高度集成 - DHGuidePageHUD - ②)
距上一篇博客"APP引导页的高度集成 - DHGuidePageHUD - ①"的发布有一段时间了, 后来又在SDK中补充了一些新的内容进去但是一直没来得及跟大家分享, 今天来跟大 ...
随机推荐
- Linux修改系统主机名
Linux修改系统主机名 一.查看主机名 [root@xqzt ~]# uname -n xqzt [root@xqzt ~]# hostname xqzt 二.修改hostname的四种方式? ...
- 将excel表导入到mysql中
//导入excel表 方法一: )打开Excel另存为CSV文件 )将文件编码转化为utf8,用NotePad++打开csv文件,选择格式—转为utf8编码格式—保存 )在MySQL建表,字段的顺序要 ...
- android手机导入.cer证书文件的方法
访问很多https协议的网站需要安装证书,手机也可以导入cer文件,你知道么?本文将通过简单的两步告诉你手机安装cer文件的方法. 步骤一:请先将数字证书文件“******.cer”文件复制到SD卡的 ...
- loadrunner error 27796 Failed to connect to server
(2012-10-23 01:23:17) 转载▼ Action.c(58): Error -27796: Failed to connect to server "www.baidu. ...
- Tomcat服务器版本号泄露-低危漏洞修复
一.问题描述Tomcat报错页面泄漏Apache Tomcat/7.0.52相关版本号信息,是攻击者攻击的途径之一.因此实际当中建议去掉版本号信息.二.解决办法 1.进入到tomcat/lib目录下, ...
- 开源通用型渲染工具-SwiftShader--OpenGL的替代者
SwiftShader 是一款用于在 CPU 上进行高性能图形渲染的软件库.Google 已经在很多产品中使用该内容库,包括 Chrome.Android 开发工具和云服务.Swiftshader 从 ...
- .NET(C#):警惕PLINQ结果的无序性
.NET(C#):警惕PLINQ结果的无序性 2012年08月10日 ⁄ 综合 ⁄ 共 620字 ⁄ 字号 小 中 大 ⁄ 评论关闭 PLINQ的运行结果是无序的,也就是不保持原来集合的顺序来操作 ...
- Oracle Tuxedo工作站客户端与服务端的样例程序
服务端代码: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <cty ...
- C#代码优化—字符串拼接效率比较
字符串拼接主要有以下几种方法: + : 加号 String.Format() : 字符串格式化 StringBuilder.Append() 说明 对于少量固定的字符串拼接,如string str = ...
- Ubuntu常用命令大全[显示桌面]
Ubuntu常用命令大全 查看软件xxx安装内容 #dpkg -L xxx 查找软件 #apt-cache search 正则表达式 查找文件属于哪个包 #dpkg -S filename apt-f ...