標籤:
版本判斷:
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啟動載入啟動圖片