有一个注意点:

获取版本号
个叫做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. python学习笔记三--字典

    一.字典: 1. 不是序列,是一种映射, 键 :值的映射关系. 2. 没有顺序和位置的概念,只是把值存到对应的键里面. 3. 通过健而不是通过偏移量来读取 4. 任意对象的无序集合 5. 可变长,异构 ...

  2. bzoj4008

    好题,这题可以分开算每个技能的贡献 orz popoqqq http://blog.csdn.net/popoqqq/article/details/45365759 ..,..] of double ...

  3. poj3216

    这是一道描述非常不清楚的题目 首先解释一下,题目中的ti是任务开始时间不是结束时间, 然后维修人员可以理解为可以再任意时间从公司出发: 好,首先不难想到用floyd预处理一下: 然后我们把每个任务看成 ...

  4. C#中父窗口和子窗口之间实现控件互操作

    很多人都苦恼于如何在子窗体中操作主窗体上的控件,或者在主窗体中操作子窗体上的控件.相比较而言,后面稍微简单一些,只要在主窗体中创建子窗体的时候,保留所创建子窗体对象即可. 下面重点介绍前一种,目前常见 ...

  5. HAOI2011 problem b

    2301: [HAOI2011]Problem b Time Limit: 50 Sec  Memory Limit: 256 MBSubmit: 1047  Solved: 434[Submit][ ...

  6. [转] 字符串模式匹配算法——BM、Horspool、Sunday、KMP、KR、AC算法一网打尽

    字符串模式匹配算法——BM.Horspool.Sunday.KMP.KR.AC算法一网打尽 转载自:http://dsqiu.iteye.com/blog/1700312 本文内容框架: §1 Boy ...

  7. ejabberd的多域名(domain)设置

    在ejabberd中可以支持多个domain,我讲一下我的配置过程我的ejabberd系统是:ejabberd server+sql server+openldap+gateway.我总共使用了5台机 ...

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

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

  9. 消息系统Kafka介绍

    1.  概述 Kafka是Linkedin于2010年12月份开源的消息系统,它主要用于处理活跃的流式数 据.活跃的流式数据在web网站应用中非常常见,这 些数据包括网站的pv.用户访问了什么内容,搜 ...

  10. Linux批量修改指定目录下的文件或文件夹权限

    在Puppet下很头大,尤其是文件拷贝,使用file的mode会导致文件或文件夹都一个权限. 暂时使用命令代替: 最近忙着明年的N多计划,待有空后继续研究.