对不起,如果这个问题已经发布了..
我想使用 XCode 4.2 和 iPhone SDK 5.0 以编程方式创建 TabBar 和 NavigationBar 的组合
它按预期产生视觉效果..但是当按下(录制) TabBarItem 以更改为其相应的视图时,它会产生错误:[__NSCFString _tabBarItemClicked:]: unrecognized selector sent to instance
这是AppDelegate的实现
#import "ApplicationDelegat.h"
#import "BrightnessController.h"
@implementation ApplicationDelegat
@synthesize window;
//@synthesize bControl;
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
NSMutableArray *controllers = [NSMutableArray array];
UITabBarController *tbarController = [[UITabBarController alloc] init];
for (int i = 0; i <= 3; i++)
{
//self.bControl = [[BrightnessController alloc] initWithBrightness:i];
BrightnessController *bControl = [[BrightnessController alloc] initWithBrightness:i];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController: /*self.bControl*/bControl];
nav.navigationBar.barStyle = UIBarStyleBlackTranslucent;
[controllers addObject: nav];
//bControl.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"test" image:nil tag:i];
//tbarController.navigationController.delegate = self;
}
tbarController.viewControllers = controllers;
tbarController.customizableViewControllers = controllers;
tbarController.selectedIndex = 0;
tbarController.delegate = self;
// NSCFString
//tabBarItem
// Set up the window
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window addSubview:tbarController.view];
[self.window makeKeyAndVisible];
}
@end
我不知道它为什么会发生以及如何恢复它..有人帮助我。
如果需要更多详细信息,我可以提供源代码...
提前致谢。