有一个注意点:

获取版本号
个叫做Version,一个叫做Build,这两个值都可以在Xcode 中选中target,点击“Summary”后看到。 Version在plist文件中的key是“CFBundleShortVersionString”,和AppStore上的版本号保持一致,Build在plist中的key是“CFBundleVersion”,代表build的版本号,该值每次build之后都应该增加1。这两个值都可以在程序中通过下面的代码获得:
 
1.Version
NSString *key = @"CFBundleShortVersionString";
2.build
NSString *key =@"CFBundleVersion";

1.在AppDelegate.m

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; NSString *key = @"CFBundleShortVersionString";
//上一个版本号,存沙盒
NSString *lastVersion = [[NSUserDefaults standardUserDefaults] objectForKey:key];
//当前版本号
NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];
NSLog(@"前面%@----当前%@",lastVersion,currentVersion); if ([currentVersion isEqualToString:lastVersion]) {
self.window.rootViewController = [ViewController new]; //为真表示已有文件 曾经进入过主页
}else{
self.window.rootViewController =[LGFNEWfeatureViewController new];//为假表示没有文件,没有进入过主页
[[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:key];
[[NSUserDefaults standardUserDefaults] synchronize];
}
[self.window makeKeyAndVisible]; return YES;
}

2.在新特性的VC中:

 #import "LGFNEWfeatureViewController.h"
#import "ViewController.h" #define LGFNEWFeatureCount 3
@interface LGFNEWfeatureViewController ()<UIScrollViewDelegate>
@property(nonatomic,strong)UIScrollView *scrollView; @property(nonatomic,strong)UIPageControl *pageControl; @end @implementation LGFNEWfeatureViewController - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setScrollerView];
} -(void)setScrollerView{
self.scrollView = [UIScrollView new];
_scrollView.frame = self.view.bounds;
_scrollView.contentSize = CGSizeMake(LGFNEWFeatureCount *self.view.frame.size.width, );
_scrollView.bounces = NO;
_scrollView.pagingEnabled = YES;
_scrollView.showsHorizontalScrollIndicator =NO;
[self.view addSubview:_scrollView];
for (int i =; i<LGFNEWFeatureCount; i++) {
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width*i, , self.view.frame.size.width, self.view.frame.size.height)];
imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d",i+]];
[_scrollView addSubview:imageView];
if (i == LGFNEWFeatureCount-) {
[self setupLastImageView:imageView];
}
}
_scrollView.delegate = self; self.pageControl = [[UIPageControl alloc] initWithFrame:CGRectMake(, self.view.frame.size.height-, self.view.frame.size.width-,)];
_pageControl.numberOfPages = LGFNEWFeatureCount;
_pageControl.currentPageIndicatorTintColor =[UIColor orangeColor];
_pageControl.userInteractionEnabled = NO;
[self.view addSubview:_pageControl]; } -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
self.pageControl.currentPage = self.scrollView.contentOffset.x/self.view.frame.size.width;
} -(void)setupLastImageView:(UIImageView*)imageView{
//开启用户交互
imageView.userInteractionEnabled = YES;
//1.分享
UIButton *sharedBtn =[[UIButton alloc] initWithFrame:CGRectMake(, self.view.frame.size.height-, self.view.frame.size.width*0.5,self.view.frame.size.height*0.3)]; [sharedBtn setImage:[UIImage imageNamed:@"shared"] forState:UIControlStateNormal];
[sharedBtn setImage:[UIImage imageNamed:@"sharedselect"] forState:UIControlStateSelected];
[sharedBtn setTitle:@"分享给大家" forState:UIControlStateNormal];
sharedBtn.titleEdgeInsets = UIEdgeInsetsMake(, , , );
sharedBtn.titleLabel.font = [UIFont systemFontOfSize:];
[sharedBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[sharedBtn addTarget:self action:@selector(sharedBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[imageView addSubview:sharedBtn]; //2.开始程序首页
UIButton *startBtn = [[UIButton alloc] initWithFrame:CGRectMake(, self.view.frame.size.height*0.88, self.view.frame.size.width*0.4,self.view.frame.size.height*0.05)];
startBtn.layer.cornerRadius = 12.0f;
startBtn.layer.masksToBounds =YES;
startBtn.backgroundColor = [UIColor orangeColor];
[startBtn setTitle:@"开启APP之旅" forState:UIControlStateNormal];
[startBtn addTarget:sharedBtn action:@selector(startBtnClick) forControlEvents:UIControlEventTouchUpInside];
[imageView addSubview:startBtn]; } -(void)sharedBtnClick:(UIButton *)sharedBtn{
sharedBtn.selected = !sharedBtn.selected;
} -(void)startBtnClick{
UIWindow *win =[UIApplication sharedApplication].keyWindow;
win.rootViewController = [ViewController new];
}

iOS新特性引导页的更多相关文章

  1. iOS彩票项目--第五天,新特性引导页的封装、返回按钮的自定义、导航控制器的滑动返回以及自定义滑动返回功能

    一.上次实现了在AppDelegate中通过判断app版本决定是否进入新特性页面,今天将AppDelegate中的一坨进行了封装.将self.window的根控制器到底应该为新特性界面,还是主页面,封 ...

  2. ios新特性

    @import  在xcode 5 下,为了更易于开发,增加了modules和 auto-linking 这两个新特性: 在以前,如果你要使用MapKit这个框架,你要这样做 1) 使用语句 #imp ...

  3. 3DTouch - iOS新特性

    概述 3DTouch是一种立体触控技术,被苹果称为新一代多点触控技术. 详细 代码下载:http://www.demodashi.com/demo/10708.html 6s和6s plus之后特有效 ...

  4. ios新特性(泛型)

    协变 子类转父类   逆变父类给子类赋值

  5. iOS 新特性关键字

    1.用来修饰属性,或者方法的参数,方法的返回值 /** nullable:表示可以传空 */ //@property (nonatomic, strong, nullable) NSString *n ...

  6. IOS 一句代码搞定启动引导页

    前言引导页,一个酷炫的页面,自从微博用了之后一下就火起来了,对于现在来说一个app如果没有引导页似乎总显那么不接地气,那么为了让我们的app也“高大上”一次,我写了一个demo来实现启动引导页的实现, ...

  7. 返璞归真 asp.net mvc (6) - asp.net mvc 2.0 新特性

    原文:返璞归真 asp.net mvc (6) - asp.net mvc 2.0 新特性 [索引页][源码下载] 返璞归真 asp.net mvc (6) - asp.net mvc 2.0 新特性 ...

  8. iOS App引导页功能实现

    一.写作原因 以前都没有想着来写点东西,今天遇到件事情让我决定每次还是要做记录.因为以前自己可以轻松的完成pod spec的配置,但是今天在做的时候还是忘了遇到了很多坑.pod spec配置遇到的坑不 ...

  9. iOS帅气加载动画、通知视图、红包助手、引导页、导航栏、朋友圈、小游戏等效果源码

    iOS精选源码 如丝般顺滑的微信朋友圈(点赞,评论,图文混排表情,... 动态菜单第三版本:动态项,自适应方向 仿appstore首页滚动效果 iOS 透明导航栏方案 TransparentNavig ...

随机推荐

  1. Android 动态Tab分页效果

    当前项目使用的是TabHost+Activity进行分页,目前要做个报表功能,需要在一个Tab页内进行Activity的切换.比方说我有4 个Tab页分别为Tab1,Tab2,Tab3,Tab4,现在 ...

  2. P114、面试题17:合并两个排序的链表

    题目:输入两个递增排序的链表,合并这两个链表并使新链表中的结点仍然是按照递增顺序的.struct ListNode{      int    m_nKey;      ListNode*    m_p ...

  3. ogg实现oracle到sql server 2005的同步

    一.源端(oracle)配置1.创建同步测试表create table gg_user.t01(name varchar(20) primary key);create table gg_user.t ...

  4. POJ1182

    这题需要注意就是 并查集中 相对位置 注意与绝对距离区别 #include<cstdio> #define maxn 50005 int ans,i,a,b,p,fa,fb,n,k; in ...

  5. bq27441-G1 工作机制

    /*************************************************************************** * bq27441-G1 工作机制 * 声明: ...

  6. (十三)学习CSS之两个class连一起隔空格和逗号

    1.时常见到css的这两种种写法: a.两个class隔空格连一起: .class1 .class2{......} b.两个class隔逗号连一起: .class1,.class2{......} ...

  7. Android学习系列(22)--App主界面比较

    本文算是一篇漫谈,谈一谈当前几个流行应用的主界面布局,找个经典的布局我们自己也来实现一个.不是为了追求到底有多难,而是为了明白我们确实需要这么做. 走个题,android的UI差异化市场依然很大,依然 ...

  8. u-boot 环境变量参数设置

    今天本来是烧写内核,结果一不小心把uboot也整不能用了,无奈之下只好重新烧个uboot,等都弄好以后,发现系统还是启动不了,原来是启动参数设置不对,于是找到了这篇文章,//是我添加的内容. 原文地址 ...

  9. 关于SQL中的Update语句

    今天在SQL数据库操作时需要将一张表中的数据Update到另一张表中去, 可是用我以往的写法确怎么也不能成功.代码如下: update table1 a set a.Col1=b.Col2 from ...

  10. 1、WWDC2014 详解OSX/iOS8/Swift语言

    OS X 10新特性 1.系统图标扁平化. 2.系统菜单栏可定制. 3.新的通知中心. 4.新的Spotlight. 5.新的iCloud Drive,新增文档同步功能(学Windows). 6.新的 ...