thể trùng lặp:
Show activity indicator during application launchThêm một Hoạt động Chỉ số lập trình để một Xem
All,
Bên đại biểu ứng dụng của tôi, tôi tạo ra một cái nhìn giật gân hoạt hình có sử dụng mặc định của tôi .png. Đó là tất cả các công trình OK nhưng tôi không thể hiểu làm thế nào có được ActivityIndicator của tôi để hiển thị trên đầu trang của xem giật gân. Nó chỉ ẩn bởi khung nhìn giật gân. Dưới đây là những gì tôi có và cảm ơn:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//... data access stuff here ...
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
// ... more setup stuff here ...
/****************************************************************************
*
*
* Splash Screen for iPhone
*
****************************************************************************/
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
splashView.image = [UIImage imageNamed:@"Default.png"];
[self.window addSubview:splashView];
[self.window bringSubviewToFront:splashView];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.window cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];
splashView.alpha = 0.0;
splashView.frame = CGRectMake(-60, -60, 440, 600);
[UIView commitAnimations];
//Create and add the Activity Indicator to splashView
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityIndicator.alpha = 1.0;
activityIndicator.center = CGPointMake(160, 240);
activityIndicator.hidesWhenStopped = NO;
[splashView addSubview:activityIndicator];
[activityIndicator startAnimating];
}
return YES;
}
Hi những gì nên các tham số trong (void) startupAnimationDone: (NSString *) animationID hoàn thành: (NSNumber *) hoàn thành bối cảnh: (void *) bối cảnh – morroko
hidesWhenStopped = NO là chìa khóa cho tôi, nếu không nó sẽ bị ẩn đi bất kể cái gì – noobular