ios启动载入启动图片
版本判断:
1.首先你要知道这个键值对的key:id key = (id)kCFBundleVersionKey;
2.同过本地的NSBundle取得当前的版本号。
3.在沙盒中取得对应的版本号。
4.比较来判断载入情况。
//首先获取当前版本,从plist中获取
//在bundle中查找获取当前对应的version
id key = (id)kCFBundleVersionKey;
NSDictionary *infoDictionary=[NSBundle mainBundle].infoDictionary;
NSString *currentVersion = [infoDictionary objectForKey:key]; //从沙盒获取的bundle
NSUserDefaults *defaults= [NSUserDefaults standardUserDefaults];
NSString *defaultVersion = [defaults objectForKey:key];
if ([defaultVersion isEqual:currentVersion]) {
self.window.rootViewController = [[CSMainBarController alloc]init];
}else
{
CSLaunchView *indexView = [[CSLaunchView alloc]init];
self.window.rootViewController = indexView; }
1.创建新的类来加载对应的图片。通过UIViveController上套着UIScrollView再套上一个view.
2.加载对应的view
3.加载对应的pagecontroller
//
// CSLaunchView.m
// diary
//
// Created by asheng123 on 15/4/13.
// Copyright (c) 2015年 asheng123. All rights reserved.
// #import "CSLaunchView.h"
#define LaunchImage 4
@interface CSLaunchView()<UIScrollViewDelegate>
@property(nonatomic,weak)UIPageControl *mypage;
@end
@implementation CSLaunchView -(void)viewDidLoad
{
//载入对应的scrollview的一些信息
[self loadScrollView]; //加载一个pagecontrol
[self loadPageControl];
} -(void)loadPageControl
{
UIPageControl *pageControl= [[UIPageControl alloc]init];
self.mypage = pageControl;
pageControl.numberOfPages = LaunchImage;
pageControl.x = self.view.size.width*0.5;
pageControl.y = self.view.size.height - ;
pageControl.pageIndicatorTintColor = [UIColor grayColor];
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
[self.view addSubview:pageControl];
}
-(void)loadScrollView
{
//创建一个scorllview
UIScrollView *theScorll= [[UIScrollView alloc]init];
//设置对应的尺寸
theScorll.frame =self.view.bounds;
theScorll.delegate = self;
CGFloat imageW = theScorll.frame.size.width;
CGFloat imageH = theScorll.frame.size.height;
[self.view addSubview:theScorll];
for (int i =; i<LaunchImage; i++) {
// UIImage *name=[UIImage imageNamed: [NSString stringWithFormat:@"new_feature_%d",i+1]];
NSString *name = [NSString stringWithFormat:@"new_feature_%d",i+];
if(phoneInch)
{
[name stringByAppendingString:@"@2x"];
}
UIImageView*theImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:name]];
[theScorll addSubview:theImage];
theImage.x = imageW*i;
NSLog(@"thescorll width is %f",theScorll.width);
theImage.y =;
theImage.width = imageW;
theImage.height = imageH;
}
theScorll.contentSize = CGSizeMake(LaunchImage *self.view.width,);
theScorll.pagingEnabled =YES;
theScorll.bounces =NO;
theScorll.showsHorizontalScrollIndicator =NO;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat num = (scrollView.contentOffset.x /self.view.width);
int intPage = (int)(num +0.5); self.mypage.currentPage=intPage;
}
@end
今日单词:mechanism
underpin
notion
encapsulates
corresponds
conform
conventions
lowercase
sequence
traverse
glance
observes
inform
illustration
scenario
establishes
invoked
compliant
scheme
infrastructure
compliant
demonstrates
emits
bitwise
an inspector object
maintain
triggered
proxy
manual
granular
control
nest
fragment
derived property
ios启动载入启动图片的更多相关文章
- iOS开发app启动原理及视图和控制器的函数调用顺序
main()函数是整个程序的入口,在程序启动之前,系统会调用exec()函数.在Unix中exec和system的不同在于,system是用shell来调用程序,相当于fork+exec+waitpi ...
- WebGL 启动载入触发更新流程分析
WebGL 启动载入触发更新流程分析 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转载 ...
- iOS app 程序启动原理
iOS app 程序启动原理 Info.plist: 常见设置 建立一个工程后,会在Supporting files文件夹下看到一个"工程名-Info.plist"的文件, ...
- Info.plist和pch文件的作用,UIApplication,iOS程序的启动过程,AppDelegate 方法解释,UIWindow,生命周期方法
Info.plist常见的设置 建立一个工程后,会在Supporting files文件夹下看到一个“工程名-Info.plist”的文件,该文件对工程做一些运行期的配置,非常重要,不能删除 注:在旧 ...
- ele.me在IOS浏览器端启动APP的技巧分析
ele.me在IOS浏览器端启动APP的技巧分析 巧妙利用后台重定向,在schemes启动时提示用户打开,启动不了APP时能够及时跳转至下载页面. 避免报错页面的出现以及用户还没来的及选择就跳转到下载 ...
- 怎样做一个iOS App的启动分层引导动画?
一. 为什么要写这篇文章? 这是一个很古老的话题,从两年前新浪微博开始使用多层动画制作iOS App的启动引导页让人眼前一亮(当然,微博是不是历史第一个这个问题值得商榷)之后,各种类型的引导页层出不穷 ...
- iOS App的启动过程
一.mach-O Executable 可执行文件 Dylib 动态库 Bundle 无法被连接的动态库,只能通过 dlopen() 加载 Image 指的是 Executable,Dylib 或者 ...
- IOS第六天(3:scrollView 图片轮播器)
IOS第六天(3:scrollView 图片轮播器) #import "HMViewController.h" #define kImageCount 5 @interface H ...
- iOS 解决LaunchScreen中图片加载黑屏问题
iOS 解决LaunchScreen中图片加载黑屏问题 原文: http://blog.csdn.net/chengkaizone/article/details/50478045 iOS 解决Lau ...
随机推荐
- [C++] 自己实现快速memcpy
仅在Win32上使用,Win64上不允许内嵌汇编= = __declspec(naked) void* __stdcall __memcpy ( __in void* Dest, // ebp+0x0 ...
- 简单的URL解析
简单的URL解析,直接举例说明了 function getUrl(){ //如果存在则取到来后面的参数,注意,?不需要取出,substring从1开始,否则取""; var qs ...
- Swift 编程语言自己实践 -自己在Xcode6 动手写20140603
Swift 是什么,大家都回去百度或者Google,有的甚至认为是Taylor Swift(她是我的偶像),但是如果今天在百度百科里搜索绝对没有说是Apple最新推出的编程语言,因为是在2014年6月 ...
- 鼠标焦点变化引起mouseout事件
做了个小手术,渐渐回归网络啦! 问题: 在自制的提示离鼠标太近时,会引起无法提示的功能. 自制提示离图片太近时,提示图片一直一闪一闪的,截图截不出来,就只放改善后的图片(不闪). 原因: 为什么呢?书 ...
- Chp10 10.7
<Java语言程序设计>P296 本章是关于对象的思考,主要是在研究面向对象的程序设计时类的设计,作业写得比较杂乱,构造方法时没有严格遵守类的流行设计风格,由于是作业,再加上比较简单,没有 ...
- Neo4j批量插入(Batch Insertion)
新建一个maven工程,这里不赘述如何新建maven工程. 添加Neo4j jar到你的工程 有两种方式: 上网站官网下载jar包,根据自己的系统下载不同的压缩包,详细过程不描述,请自行搜索其他博客 ...
- setup notifier actions in aodh alarm
Aodh alarm NOTIFIER ==> alarm_actions URL: http://<host>/<action> NOTIFIER will resol ...
- <a>标签的用法。
1.创建电子邮件链接: <html> <head> <title>发给朱永成</title> </head> <body> &l ...
- 分享一个ruby网站 | 菜鸟教程
http://www.runoob.com/ruby/ruby-tutorial.html 分享一个ruby网站.
- id生成策略 id工具类
import java.util.Random; /** * 各种id生成策略 * <p>Title: IDUtils</p> * <p>Description: ...