Criar uiTabBarController programaticamente
Quero criar umUIView
paraUITabBarController
Aqui está meu código para o.h
Arquivo
@interface TE : UIViewController <UITabBarControllerDelegate>{
UITabBarController *tabBarController;
}
@property (nonatomic,retain) UITabBarController *tabBarController;
@end
OviewDidLoad
método:
UIViewController *testVC = [[T1 alloc] init];
UIViewController *otherVC = [[T2 alloc] init];
NSMutableArray *topLevelControllers = [[NSMutableArray alloc] init];
[topLevelControllers addObject: testVC];
[topLevelControllers addObject: otherVC];
tabBarController = [[UITabBarController alloc] init];
tabBarController.delegate = self;
[tabBarController setViewControllers:topLevelControllers animated:NO];
tabBarController.selectedIndex = 0;
self.view = tabBarController.view;
Isso cria o controlador da barra de guias, mas quando clico em um item da barra de guias, recebo um erro:
Thread1: Sinal de recebimento do programa: SIGABRT
Edita: Resolvi o problema baixando e modificando a versão dohttp: //www.iphonedevcentral.com/create-uitabbarcontroller