【发布时间】:2014-06-13 19:52:11
【问题描述】:
我通过执行 project->General tab-> Launch Images-> 添加了启动画面
从这里我根据尺寸拍了两张照片,效果也很好。
现在我想在上面放一个活动指示器。
所以在加载我的数据库和文件之前,应该显示启动画面和指示器。
我能做些什么呢?
我也尝试了一些建议
我确实喜欢这个
[self performSelector:@selector(loadingViewFade) withObject:nil];
-
(void) loadingViewFade
loadingView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)]; loadingView.image = [UIImage imageNamed:@"splashscreen_640x960"]; [_window addSubview:loadingView]; [_window bringSubviewToFront:loadingView]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:3.0]; [UIView setAnimationDelay:3.0]; [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:_window cache:YES]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; 加载视图.alpha = 0.5f; [UIView 提交动画];
//创建Activity Indicator并将其添加到loadingView UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; 活动指标.alpha = 1.0; activityIndicator.center = CGPointMake(160, 430); activityIndicator.hidesWhenStopped = NO; UILabel *text = [[UILabel alloc]initWithFrame:CGRectMake(140, 435, 160, 30)]; text.backgroundColor = [UIColor clearColor]; text.textColor = [UIColor whiteColor]; text.font = [UIFont systemFontOfSize:14]; text.text = @"加载中..."; [加载视图添加子视图:文本]; [loadingView addSubview:activityIndicator]; [loadingView addSubview:activityIndicator]; [activityIndicator startAnimating];
(void)startupAnimationDone:(NSString *)animationID 完成:(NSNumber *)完成上下文:(void *)context
[loadingView removeFromSuperview];
再次启动以及指示器不显示,而是加载默认屏幕,直到数据库加载..请帮帮我
【问题讨论】:
标签: ios splash-screen uiactivityindicatorview