首次下载动画
首次下載動畫
#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];
}?
轉載于:https://www.cnblogs.com/lidongxiao/p/4949992.html
總結
- 上一篇: No.1010_第七次团队会议
- 下一篇: 郝斌--数据结构---汉诺塔实现(c语言