有一个注意点:

获取版本号
个叫做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. (组合数学3.1.2.1)POJ 2249 Binomial Showdown(排列组合公式的实现)

    /* * POJ_2249.cpp * * Created on: 2013年10月8日 * Author: Administrator */ #include <iostream> #i ...

  2. Miles per gallon to kilometers per liter

    Miles per gallon to kilometers per liter 1 Imperial Gallon = 4.54609188 litres 1 Mile = 1.609344 kil ...

  3. Android横竖屏切换总结

    Android横竖屏切换总结(Android资料) Android横竖屏要解决的问题应该就两个: 一.布局问题 二.重新载入问题 1.布局问题:如果不想让软件在横竖屏之间切换,最简单的办法就是在项目的 ...

  4. POJ 1149 PIGS ★(经典网络流构图)

    [题意] 有M个猪圈,每个猪圈里初始时有若干头猪.一开始所有猪圈都是关闭的.依 次来了N个顾客,每个顾客分别会打开指定的几个猪圈,从中买若干头猪.每 个顾客分别都有他能够买的数量的上限.每个顾客走后, ...

  5. win8.1 64 安装用友T3+sql2005-64步骤

    1. 环境:win8.1 64 专业版  4G内存  .net framwork 3.5 2.初始过程及所需软件 安装sql2008数据库,安装完T3发现并不支持此数据库,运行T3老是出现连接数据时的 ...

  6. 在SharePoint 2010中创建网站的权限级别

    转:http://www.360sps.com/Item/CreatePermissionLevels.aspx 权限级别是SharePoint 2010新增加的功能,使我们对权限的设置又提高了一个层 ...

  7. C#用DES加密JAVA用DES解密,JAVA用DES加密C#用DES解密的实现

    这里贴出来的是可通用的C#与jav的DES加密类,希望对大家管用直接复制即可用 C#DES加密解密类 ///<summary><![CDATA[加密解密帮助类]]></s ...

  8. ArcGIS.Server.9.3和ArcGIS API for JavaScript地图实现Toorbar功能(四)

    转自:http://www.cnblogs.com/hll2008/archive/2008/11/22/1338630.html 目的:1.ArcGIS API for JavaScript实现To ...

  9. 常用ping服务列表

    以下是收集的ping服务器. ping是基于XML_RPC标准协议的更新通告服务,是用于blog在内容更新时通知博客搜索引擎及时进行抓取.更新的方式.博客搜索引擎在成功接受到ping以后,会立刻进行抓 ...

  10. 将java应用程序打包成可执行文件

    准备工作:我用的打包软件是installanywhere.因此要先下载这个软件,这里提供一个下载地址http://www.52z.com/soft/21747.html.(网页上写的有破解方法) 详细 ...