在开始时拍摄一张 splashView 图像,如下所示...
@interface AppDelegate : UIResponder <UIApplicationDelegate>{
UIImageView *splashView;
}
@property (nonatomic, retain) UIImageView *splashView;
@end
在 AppDelegate.m 文件中...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
splashView = [[UIImageView alloc] initWithFrame:iphoneFrame];
splashView.image = [UIImage imageNamed:@"Default"];
[self.window addSubview:splashView];
[self.window makeKeyAndVisible];
UIViewController *viewController1 = [[[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil] autorelease];
UINavigationController *navviewController1=[[UINavigationController alloc]initWithRootViewController:viewController1];
navviewController1.title = @"FirstTitle";
// navviewController1.navigationBarHidden=YES;
UIViewController *viewController2 = [[[yourviewController2 alloc] initWithNibName:@"yourviewController2" bundle:nil] autorelease];
UINavigationController *navviewController2=[[UINavigationController alloc]initWithRootViewController:viewController2];
// navviewController2.navigationBarHidden=YES;
navviewController2.title = @"SecondTitle";
UIViewController *viewController3 = [[[yourviewController3 alloc] initWithNibName:@"yourviewController2" bundle:nil] autorelease];
UINavigationController *navviewController3=[[UINavigationController alloc]initWithRootViewController:viewController3];
// navviewController3.navigationBarHidden=YES;
navviewController3.title = @"ThirdTitle";
//..... and so on depend on your requirement
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navviewController1, navviewController2 , navviewController3 ,nil];
[self performSelector:@selector(loadViewIphone) withObject:nil afterDelay:2.0];//**add this line at your all data are loading completed**
}
else
{
splashView = [[UIImageView alloc] initWithFrame:ipadFrame];
splashView.image = [UIImage imageNamed:@"Default_iPad"];
[self.window addSubview:splashView];
[self.window makeKeyAndVisible];
[self performSelector:@selector(loadViewIpad) withObject:nil afterDelay:2.0];
}
[self.window makeKeyAndVisible];
return YES;
}
-(void)loadViewIphone
{
[splashView removeFromSuperview];
[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionFromBottom];
[animation setDuration:1.0];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:
kCAMediaTimingFunctionEaseInEaseOut]];
[[self.window layer] addAnimation:animation forKey:@"transitionViewAnimation"];
[self.window makeKeyAndVisible];
}
我希望这可以帮助你...