我有一個視圖控制器,其中有一些自定義按鈕,然後點擊一個按鈕,我呈現不同的視圖。按一下按鈕,我將呈現一個帶有導航控制器的標籤欄控制器。標籤欄呈現性能問題
和代碼如下
TabBarView *tabbar=[[TabBarView alloc]init];
UINavigationController *navNextController = [[UINavigationController alloc] initWithRootViewController:tabbar];
[self presentModalViewController:navNextController animated:YES];
和在標籤欄的代碼如下
UINavigationController *localNavigationController;
tabbarcontroller = [[UITabBarController alloc] init];
localControllersArray = [[NSMutableArray alloc] initWithCapacity:3];
tabbarcontroller.delegate=self;
ShoppingListView *shop;
shop = [[ShoppingListView alloc] init];
shop.parentVC=self;
localNavigationController = [[UINavigationController alloc] initWithRootViewController:shop];
[localNavigationController.tabBarItem setTitle:@"Lists"];
[localNavigationController.tabBarItem setImage:[UIImage imageWithContentsOfFile:[IMBundle fullBundlePath:@"Images.bundle/Images/EnhancedMobileLists/list.png"]]];
[localNavigationController viewWillAppear:YES];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[shop release];
FavoritesViewController *fav;
fav = [[FavoritesViewController alloc] init];
fav.parentVC=self;
localNavigationController = [[UINavigationController alloc] initWithRootViewController:fav];
[localNavigationController.tabBarItem setTitle:@"Favorites" ];
[localNavigationController.tabBarItem setImage:[UIImage imageWithContentsOfFile:[IMBundle fullBundlePath:@"Images.bundle/Images/EnhancedMobileLists/favorites.png"]]];
[localNavigationController viewWillAppear:YES];
[localNavigationController viewWillDisappear:YES];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[fav release];
ShareListViewController *share;
share = [[ShareListViewController alloc] init];
share.parentVC=self;
localNavigationController = [[UINavigationController alloc] initWithRootViewController:share];
[localNavigationController.tabBarItem setTitle:@"Share" ];
[localNavigationController.tabBarItem setImage:[UIImage imageWithContentsOfFile:[IMBundle fullBundlePath:@"Images.bundle/Images/EnhancedMobileLists/share.png"]]];
[localNavigationController viewWillAppear:YES];
[localControllersArray addObject:localNavigationController];
[localNavigationController release];
[share release];
tabbarcontroller.viewControllers = localControllersArray;
[self.view addSubview:tabbarcontroller.view];
的主要問題是,同時點擊該按鈕來呈現標籤欄查看它需要一定的時間加載即暫時看起來好像視圖被吊起來,我在另一個按鈕中呈現導航視圖,並且它沒有任何延遲地工作正常。請告訴我我的代碼有什麼問題,以及如何解決延遲問題,以在iphone中點擊uibutton時顯示標籤欄。
在此先感謝
有關自定義的TabBar以下參考鏈路指更詳細http://sugartin.info/2011/07/01/customizing-tab-bar/ –