首次下载动画

首次下载动画

#pragma mark 设置首次启动动画
// NSString *info = [NSBundle mainBundle].infoDictionary[@"CFBundleVersi on"];

// [NSThread sleepForTimeInterval:5.0f];

//创建窗口
self.window= [[UIWindowalloc]init]; self.window.backgroundColor= [UIColor

whiteColor];
self.window.frame= [UIScreen

mainScreen].bounds;

  • //  //获取版本号

  • //  NSString *key = @"CFBundleVersion";

  • //  NSString *lastVersion = [[NSUserDefaults standardUserDefaults]objectForKey:key];

// NSString *currentVersion = [NSBundle mainBundle].infoDictionary[key];

//
// if ([currentVersion isEqualToString:lastVersion]) {

self.window.rootViewController = [[SPTabBarController alloc] init];
// }else
// { self.window.rootViewController =[[WelcomeViewController alloc] init];

// [[NSUserDefaults standardUserDefaults]setObject:currentVers ion forKey:key];
// [[NSUserDefaults standardUserDefaults] synchronize];
// }

#import "WelcomeViewController.h" #import "SPTabBarController.h" #import "Define.h"
@interface WelcomeViewController ()

@property (nonatomic, strong) UIScrollView *welcome;
@property (nonatomic, strong) UIImageView *next;

@end

@implementation WelcomeViewController

- (void)viewDidLoad { [super viewDidLoad];

self.welcome = [[UIScrollView alloc] init];

self.welcome.frame = [UIScreen mainScreen].bounds;

self.welcome.contentSize = CGSizeMake(3 * kScreenWidth, kScreenHeight);

self.welcome.pagingEnabled=YES;

self.welcome.showsHorizontalScrollIndi cator=NO;

self.welcome.showsVerticalScrollIndica tor=NO;

self.welcome.bounces=NO;

for (int i=1; i < 3 + 1; i++) { UIImageView*

imageView=[[UIImageView alloc]init]; CGFloat imageX = (i - 1) *

kScreenWidth;
CGFloat imageY = 0;

imageView.frame=CGRectMake(imageX, imageY, kScreenWidth, kScreenHeight);

imageView.image=[UIImage imageNamed:[NSString

stringWithFormat:@"%d",i]]; [self.welcome

addSubview:imageView]; /**

*在最后一张图片添加进入主页的按钮

*/
if (i == 3){

[self setupLastImageView:imageView];

} }

[self.view addSubview:self.welcome]; }

-(void)setupLastImageView:(UIImageView*)im ageView

{
//在imageView上添加按钮,需要开启用户交互功

能,UIImageView这个功能默认关闭 imageView.userInteractionEnabled=YES;

UIButton* btn=[[UIButton alloc]init];

btn.frame=CGRectMake(0, 0, kScreenWidth, kScreenHeight);

[btn addTarget:self action:@selector(jumpMainPage) forControlEvents:UIControlEventTouchUpInsi de];

[imageView addSubview:btn]; }

- (void)jumpMainPage {

UIWindow* window =[UIApplication sharedApplication].keyWindow;

window.rootViewController=[[SPTabBarCo ntroller alloc]init];
}

- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning];

posted @ 2015-11-09 15:07  木子东晓东  阅读(153)  评论(0编辑  收藏  举报