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 ...
随机推荐
- <转>你相信外星人的存在吗
来自为知笔记(Wiz)
- Discuz 7.0版块横排显示版块图标和版块简介的方法
Discuz 7.0版块横排显示版块图标和版块简介的方法 最近很多朋友咨询Discuz论坛设置论坛版块横排后,如何设置显示版块图标和简介的问题. 一.显示板块图标 找到templates\defaul ...
- 解决Android应用安装快完毕时提示签名冲突
最近开发了一个Android手机应用,自己用Eclipse调试安装没问题,使用其他人调试生成的bin下的apk就会出现问题,安装到最后提示"安装签名冲突"错误,想了一下估计是没有给 ...
- Matlab中fread函数的高级使用方法及其帮助文档中容易引起歧义的地方
参考资料:http://cn.mathworks.com/help/matlab/ref/fread.html 注意:参考资料针对的Matlab版本号R2015a,我使用的是R2013b. Matla ...
- Sublime Text 3 简体中文汉化包
Sublime Text 3下载 不用说是上官方下载地址:http://www.sublimetext.com/3 Sublime Text 3 简体中文汉化包使用方法 1.将上面要求下载的subli ...
- MySql和Oracle的日期转换到底有哪些不同?我们来比较一下
1.MySql和Oracle的日期转换 mysql中有2种日期格式DATE和TIME,oracle只有一种日期格式DATE. oracle> select to_char(sysdate,'yy ...
- 对C语言的知识与能力予以自评
看到一个问卷不错,拟作为第三次作业的部分内容. 你对自己的未来有什么规划?做了哪些准备?我准备在将来成为一名合格的软件工作人员,我已经在平时有空的时间里着手代码的练习. 你认为什么是学习?学习有什么用 ...
- Equls 和==的区别
对于值类型,如果对象的值相等,则相等运算符 (==) 返回 true,否则返回 false.对于string 以外的引用类型,如果两个对象引用同一个对象,则 == 返回 true.对于 string ...
- windows server 2012 FTP SMB 文件夹权限继承
被坑了..win默认的权限继承,有继承就没有smb目录继承,有smb目录继承 父级文件夹的权限就删不掉.. 换ftp轻松愉快...
- Unity浅析
在分析PRISM项目的时候, 发现里面用到了Unity 这个Component, 主要用于依赖注入的.由于对其不熟悉,索性分析了一下,记载在此,以作备忘. 任何事物的出现,总有它独特的原因,Unity ...