iPhoneのオープニングアニメーションおよびナビゲーション付きラベルバーコントローラの初期化
3693 ワード
多くのプログラムはアニメーションを開始する必要がありますが、Defaultだけです.pngはまた自分の需要を満たすことができなくて、例えば時間が短すぎます.解決する最善の方法はViewControllerを追加することです.私の名前はOpeningViewControllerです.
AppDelegateでh中声明:
AppDelegateでmでは以下のようになります.
-(void)setupUI;に表示する.ここでは、以下のようにナビゲーション付きラベルバーコントローラを初期化します.
AppDelegateでh中声明:
OpeningViewController *openingViewController;
...
@property (nonatomic, retain) OpeningViewController *openingViewController;
AppDelegateでmでは以下のようになります.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
if(openingViewController == nil)
openingViewController = [[OpeningViewController alloc] initWithNibName:@"OpeningViewController" bundle:nil];
[window addSubview:openingViewController.view];
[window makeKeyAndVisible];
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
[self performSelectorInBackground:@selector(removeOpeningView) withObject:nil];
[pool release];
return YES;
}
-(void) removeOpeningView
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
[NSThread sleepForTimeInterval:3];
//[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
[self setupUI];
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
[pool release];
}
-(void)setupUI;に表示する.ここでは、以下のようにナビゲーション付きラベルバーコントローラを初期化します.
-(void) setupUI {
UIColor *titleBarColor=[UIColor colorWithRed:0.0/255.0 green:173.0/255.0 blue:238.0/255.0 alpha:1.0];
//TabBar Item 1
mainDirectoryViewController = [[MainDirectoryViewController alloc] initWithNibName:@"MainDirectoryViewController" bundle:nil];
if (mainDirNavController == nil)
mainDirNavController = [[UINavigationController alloc] initWithRootViewController:mainDirectoryViewController];
mainDirNavController.navigationBar.tintColor = titleBarColor;
//TabBar Item 2
bookmarkViewController = [[BookmarkViewController alloc] initWithNibName:@"BookmarkViewController" bundle:nil];
if (bookmarkNavController == nil)
bookmarkNavController = [[UINavigationController alloc] initWithRootViewController:bookmarkViewController];
bookmarkNavController.navigationBar.tintColor = titleBarColor;
//TabBar Item 3
aboutViewController = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
if (aboutNavController == nil)
aboutNavController = [[UINavigationController alloc] initWithRootViewController:aboutViewController];
aboutNavController.navigationBar.tintColor = titleBarColor;
UITabBarItem *customItem1 = [[UITabBarItem alloc] initWithTitle:@" " image:[UIImage imageNamed:@"some.png"] tag:0];
UITabBarItem *customItem2 = [[UITabBarItem alloc] initWithTitle:@" " image:[UIImage imageNamed:@"some.png"] tag:1];
UITabBarItem *customItem3 = [[UITabBarItem alloc] initWithTitle:@" " image:[UIImage imageNamed:@"some.png"] tag:2];
mainTabBar = [[UITabBarController alloc] init];
mainTabBar.delegate = self;
mainTabBar.viewControllers = [NSArray arrayWithObjects:mainDirNavController, bookmarkNavController, aboutNavController, nil];
mainDirNavController.tabBarItem = customItem1;
bookmarkNavController.tabBarItem = customItem2;
aboutNavController.tabBarItem = customItem3;
[customItem1 release];
[customItem2 release];
[customItem3 release];
[window addSubview:mainTabBar.view];
}