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