我有一个视图控制器,其中有一些自定义按钮,然后点击一个按钮,我呈现不同的视图。按一下按钮,我将呈现一个带有导航控制器的标签栏控制器。标签栏呈现性能问题
和代码如下
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/ –