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

转载于:https://www.cnblogs.com/asheng/p/4423434.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值