有一个注意点:

获取版本号
个叫做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. Linux C/C++ 编程练手 --- 大数相加和大数相乘

    最近写了一个大数相乘和相加的程序,结果看起来是对的.不过期间的效率可能不是最好的,有些地方也是临时为了解决问题而直接写出来的. 可以大概说一下相乘和相加的解决思路(当然,大数操作基本就是两个字符串的操 ...

  2. Flash Builder 4.6 找不到所需的Adobe Flash Player

    问题: 安装完Flash Builder 4.6 ,第一次运行项目,出现如下错误提示: “Flash Builder 找不到所需版本的 Adobe Flash Player.您可能需要安装该版本的 F ...

  3. Redis文档

    http://manual.csser.com/redis/connection/auth.html

  4. 让Windows Server 2008 + IIS 7+ ASP.NET 支持10万个同时请求

    具体设置如下: 1. 调整IIS 7应用程序池队列长度 由原来的默认1000改为65535. IIS Manager > ApplicationPools > Advanced Setti ...

  5. iframe控件

    function goTo(url) { document.getElementById("iframeid").src = url; //获得要显示的页面,当点击时就会在ifra ...

  6. UVa 120 (构造) Stacks of Flapjacks

    这题求解的过程和选择排序非常相似. 反转的过程中分为无序(在前面)和有序(在后面)两个部分,一开始视为全部为无序. 在无序部分中找到最大的元素,先把它翻到最前面,然后再反转到无序部分的最后面.这样该元 ...

  7. SharePoint Security and Permission System Overview

    转:http://www.sharepointblues.com/2010/09/01/sharepoint-security-and-permission-system-overview/ Shar ...

  8. [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.4.1

    Let $x,y,z$ be linearly independent vectors in $\scrH$. Find a necessary and sufficient condition th ...

  9. 可用于Hadoop下的ETL工具——Kettle

    看大家分享了好多hadoop相关的一些内容,我为大家介绍一款ETL工具——Kettle.    Kettle是pentaho公司开源的一款ETL工具,跟hadoop一样,也是java实现,其目的就是做 ...

  10. hbase分页查询

    为了广大技术爱好者学习netty,在这里帮新浪微博@nettying宣传下他出版的新书 <netty权威指南>@nettying兄在华为NIO实践多年,这本书是他的技术和经验的一个结晶.N ...