启动动画以及视图
http://blog.csdn.net/zltianhen/article/details/6737958
http://www.weste.net/2011/9-22/76761.html
有两种方法
//设置一个图片;
UIImageView *niceView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
niceView.image = [UIImage imageNamed:@"Default.png"];
//添加到场景
[self.window addSubview:niceView];
//放到最顶层;
[self.window bringSubviewToFront:niceView];
//开始设置动画;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.0];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.window cache:YES];
[UIView setAnimationDelegate:self];
//這裡還可以設置回調函數;
//[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
niceView.alpha = 0.0;
niceView.frame = CGRectMake(-60, -85, 440, 635);
[UIView commitAnimations];
[niceView release];
给iOS程序上加了一个启动画面Default.png,下面是启动图片的加载代码:
self.connectionTimer=[NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:self.connectionTimer forMode:NSDefaultRunLoopMode];
do{
[[NSRunLoop currentRunLoop]runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]];
}while (!done);
-(void)timerFired:(NSTimer *)timer{
done = YES;
}