私はUINavigationControllers自分のアプリケーションで扱っており、すべてによって処理されますUITabBarController。コントローラーが自動生成された「その他」タブに入るまで、すべて正常に動作します。
単純化した例で問題を再現しました。私は何か間違ったことをしていますか?わかりません。
ご協力いただきありがとうございます。
#import <UIKit/UIKit.h>
@interface testAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate>
{
UIWindow *ウィンドウ;
UITabBarController *tabBarController;
}
@property (非アトミック、保持) IBOutlet UIWindow *window;
@property (非アトミック、保持) IBOutlet UITabBarController *tabBarController;
@終わり
@implementation testAppDelegate
@synthesize ウィンドウ、tabBarController;
- (void)applicationDidFinishLaunching:(UIApplication *)アプリケーション
{
tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
UINavigationController *ctrl1 = [[[UINavigationController alloc] initWithNibName:nil bundle: nil] autorelease];
ctrl1.tabBarItem = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured タグ:1] autorelease];
UINavigationController *ctrl2 = [[[UINavigationController alloc] initWithNibName:nil bundle: nil] autorelease];
ctrl2.tabBarItem = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFavorites タグ:2] autorelease];
UINavigationController *ctrl3 = [[[UINavigationController alloc] initWithNibName:nil bundle: nil] autorelease];
ctrl3.tabBarItem = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemBookmarks タグ:3] autorelease];
UINavigationController *ctrl4 = [[[UINavigationController alloc] initWithNibName:nil bundle: nil] autorelease];
ctrl4.tabBarItem = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemContacts タグ:4] autorelease];
// これは機能しません
UINavigationController *ctrl5 = [[[UINavigationController alloc] initWithNibName:nil bundle: nil] autorelease];
ctrl5.tabBarItem = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemMostRecent タグ:5] autorelease];
// これは動作します
UIViewController *ctrl6 = [[[UIViewController alloc] initWithNibName:nil bundle: nil] autorelease];
ctrl6.tabBarItem = [[[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemDownloads タグ:6] autorelease];
tabBarController.viewControllers = [NSArray arrayWithObjects:ctrl1, ctrl2, ctrl3, ctrl4, ctrl5, ctrl6, nil];
[ウィンドウ addSubview:tabBarController.view];
[ウィンドウ makeKeyAndVisible];
}
- (無効)dealloc
{
[tabBarController リリース];
[ウィンドウリリース];
[スーパーdealloc];
}
@終わり