ios启动载入启动图片

2024-06-14 22:32
文章标签 启动 图片 ios 载入

本文主要是介绍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 - 30;
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 =0; i<LaunchImage; i++) {
//        UIImage *name=[UIImage imageNamed:   [NSString stringWithFormat:@"new_feature_%d",i+1]];
NSString *name = [NSString stringWithFormat:@"new_feature_%d",i+1];
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 =0;
theImage.width = imageW;
theImage.height = imageH;
}
theScorll.contentSize = CGSizeMake(LaunchImage *self.view.width,0);
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启动载入启动图片的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1061676

相关文章

Android里面的Service种类以及启动方式

《Android里面的Service种类以及启动方式》Android中的Service分为前台服务和后台服务,前台服务需要亮身份牌并显示通知,后台服务则有启动方式选择,包括startService和b... 目录一句话总结:一、Service 的两种类型:1. 前台服务(必须亮身份牌)2. 后台服务(偷偷干

Python利用PIL进行图片压缩

《Python利用PIL进行图片压缩》有时在发送一些文件如PPT、Word时,由于文件中的图片太大,导致文件也太大,无法发送,所以本文为大家介绍了Python中图片压缩的方法,需要的可以参考下... 有时在发送一些文件如PPT、Word时,由于文件中的图片太大,导致文件也太大,无法发送,所有可以对文件中的图

java获取图片的大小、宽度、高度方式

《java获取图片的大小、宽度、高度方式》文章介绍了如何将File对象转换为MultipartFile对象的过程,并分享了个人经验,希望能为读者提供参考... 目China编程录Java获取图片的大小、宽度、高度File对象(该对象里面是图片)MultipartFile对象(该对象里面是图片)总结java获取图片

Windows设置nginx启动端口的方法

《Windows设置nginx启动端口的方法》在服务器配置与开发过程中,nginx作为一款高效的HTTP和反向代理服务器,被广泛应用,而在Windows系统中,合理设置nginx的启动端口,是确保其正... 目录一、为什么要设置 nginx 启动端口二、设置步骤三、常见问题及解决一、为什么要设置 nginx

springboot启动流程过程

《springboot启动流程过程》SpringBoot简化了Spring框架的使用,通过创建`SpringApplication`对象,判断应用类型并设置初始化器和监听器,在`run`方法中,读取配... 目录springboot启动流程springboot程序启动入口1.创建SpringApplicat

树莓派启动python的实现方法

《树莓派启动python的实现方法》本文主要介绍了树莓派启动python的实现方法,文中通过图文介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 目录一、RASPBerry系统设置二、使用sandroidsh连接上开发板Raspberry Pi三、运

Java实战之自助进行多张图片合成拼接

《Java实战之自助进行多张图片合成拼接》在当今数字化时代,图像处理技术在各个领域都发挥着至关重要的作用,本文为大家详细介绍了如何使用Java实现多张图片合成拼接,需要的可以了解下... 目录前言一、图片合成需求描述二、图片合成设计与实现1、编程语言2、基础数据准备3、图片合成流程4、图片合成实现三、总结前

使用Python实现图片和base64转换工具

《使用Python实现图片和base64转换工具》这篇文章主要为大家详细介绍了如何使用Python中的base64模块编写一个工具,可以实现图片和Base64编码之间的转换,感兴趣的小伙伴可以了解下... 简介使用python的base64模块来实现图片和Base64编码之间的转换。可以将图片转换为Bas

css实现图片旋转功能

《css实现图片旋转功能》:本文主要介绍了四种CSS变换效果:图片旋转90度、水平翻转、垂直翻转,并附带了相应的代码示例,详细内容请阅读本文,希望能对你有所帮助... 一 css实现图片旋转90度.icon{ -moz-transform:rotate(-90deg); -webkit-transfo

C#实现添加/替换/提取或删除Excel中的图片

《C#实现添加/替换/提取或删除Excel中的图片》在Excel中插入与数据相关的图片,能将关键数据或信息以更直观的方式呈现出来,使文档更加美观,下面我们来看看如何在C#中实现添加/替换/提取或删除E... 在Excandroidel中插入与数据相关的图片,能将关键数据或信息以更直观的方式呈现出来,使文档更