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中补充了一些新的内容进去但是一直没来得及跟大家分享, 今天来跟大 ...
随机推荐
- SUMIF
SUMIF(range,criteria,sum_range) Range:条件区域,用于条件判断的单元格区域. Criteria:求和条件,由数字.逻辑表达式等组成的判定条件.criteria 参数 ...
- centos nginx+php+mysql 安装libiconv不成功
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz tar -zxvf libiconv-1.13.1.tar.gzcd l ...
- Ubuntu12.04安装并配置Sublime Text 2
Ubuntu是个好系统,Sublime Text 是个好编辑器. 下载&安装 个人习惯喜欢到官网下载软件,http://www.sublimetext.com/2 选择合适的包下载回来的格式是 ...
- JavaScript callback function 回调函数的理解
来源于:http://mao.li/javascript/javascript-callback-function/ 看到segmentfault上的这个问题 JavaScript 回调函数怎么理解, ...
- uitableview 和UISearchBar 下拉提示结合使用
自定cell的代码 餐厅的实体和餐厅对应控件的frame #import <Foundation/Foundation.h> @class RestaurantFrame; @interf ...
- (原)tensorflow中函数执行完毕,显存不自动释放
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/7608916.html 参考网址: https://stackoverflow.com/question ...
- 单个APP页面支持屏幕旋转
1.info中支持所有的方向 2.APPDelega.h中添加属性 @property (nonatomic,assign) BOOL allowRotate; APPdelegate.m中实现方法 ...
- Redis学习之路(005)- redis内存数据库C客户端hiredis API 中文说明
A)编译安装 make make install (/usr/local) make install PREFIX=$HOME/progs(可以自由指定安装路径) B)同步的API接口 redisCo ...
- Java and C# Comparison
原文:http://www.harding.edu/fmccown/java_csharp_comparison.html Java Program Structure C# package hell ...
- golang ---image
package main import ( "image" "image/color" "image/gif" "os" ...