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

相关文章

检查 Nginx 是否启动的几种方法

《检查Nginx是否启动的几种方法》本文主要介绍了检查Nginx是否启动的几种方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学... 目录1. 使用 systemctl 命令(推荐)2. 使用 service 命令3. 检查进程是否存在4

Java使用Spire.Doc for Java实现Word自动化插入图片

《Java使用Spire.DocforJava实现Word自动化插入图片》在日常工作中,Word文档是不可或缺的工具,而图片作为信息传达的重要载体,其在文档中的插入与布局显得尤为关键,下面我们就来... 目录1. Spire.Doc for Java库介绍与安装2. 使用特定的环绕方式插入图片3. 在指定位

解决idea启动项目报错java: OutOfMemoryError: insufficient memory

《解决idea启动项目报错java:OutOfMemoryError:insufficientmemory》:本文主要介绍解决idea启动项目报错java:OutOfMemoryError... 目录原因:解决:总结 原因:在Java中遇到OutOfMemoryError: insufficient me

SpringBoot项目整合Netty启动失败的常见错误总结

《SpringBoot项目整合Netty启动失败的常见错误总结》本文总结了SpringBoot集成Netty时常见的8类问题及解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参... 目录一、端口冲突问题1. Tomcat与Netty端口冲突二、主线程被阻塞问题1. Netty启动阻

SpringBoot整合Kafka启动失败的常见错误问题总结(推荐)

《SpringBoot整合Kafka启动失败的常见错误问题总结(推荐)》本文总结了SpringBoot项目整合Kafka启动失败的常见错误,包括Kafka服务器连接问题、序列化配置错误、依赖配置问题、... 目录一、Kafka服务器连接问题1. Kafka服务器无法连接2. 开发环境与生产环境网络不通二、序

Python多任务爬虫实现爬取图片和GDP数据

《Python多任务爬虫实现爬取图片和GDP数据》本文主要介绍了基于FastAPI开发Web站点的方法,包括搭建Web服务器、处理图片资源、实现多任务爬虫和数据可视化,同时,还简要介绍了Python爬... 目录一. 基于FastAPI之Web站点开发1. 基于FastAPI搭建Web服务器2. Web服务

Java JAR 启动内存参数配置指南(从基础设置到性能优化)

《JavaJAR启动内存参数配置指南(从基础设置到性能优化)》在启动Java可执行JAR文件时,合理配置JVM内存参数是保障应用稳定性和性能的关键,本文将系统讲解如何通过命令行参数、环境变量等方式... 目录一、核心内存参数详解1.1 堆内存配置1.2 元空间配置(MetASPace)1.3 线程栈配置1.

利用Python将PDF文件转换为PNG图片的代码示例

《利用Python将PDF文件转换为PNG图片的代码示例》在日常工作和开发中,我们经常需要处理各种文档格式,PDF作为一种通用且跨平台的文档格式,被广泛应用于合同、报告、电子书等场景,然而,有时我们需... 目录引言为什么选择 python 进行 PDF 转 PNG?Spire.PDF for Python

uni-app小程序项目中实现前端图片压缩实现方式(附详细代码)

《uni-app小程序项目中实现前端图片压缩实现方式(附详细代码)》在uni-app开发中,文件上传和图片处理是很常见的需求,但也经常会遇到各种问题,下面:本文主要介绍uni-app小程序项目中实... 目录方式一:使用<canvas>实现图片压缩(推荐,兼容性好)示例代码(小程序平台):方式二:使用uni

Android实现图片浏览功能的示例详解(附带源码)

《Android实现图片浏览功能的示例详解(附带源码)》在许多应用中,都需要展示图片并支持用户进行浏览,本文主要为大家介绍了如何通过Android实现图片浏览功能,感兴趣的小伙伴可以跟随小编一起学习一... 目录一、项目背景详细介绍二、项目需求详细介绍三、相关技术详细介绍四、实现思路详细介绍五、完整实现代码