单击tabBar时以编程方式创建UITabBarController - SIGABRT

时间:2011-10-15 22:06:55

标签: uitabbarcontroller ios5

我尝试以编程方式创建UITabBarController,但是当我点击tabBarItem时我有一个SIGABRT。

来源:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    tabBarController = [[UITabBarController alloc] init];

    UIViewController *vc1 = [[UIViewController alloc] init];
    UIViewController *vc2 = [[UIViewController alloc] init];

    UIView *v1 = [[UIView alloc] init];
    UIView *v2 = [[UIView alloc] init];

    vc1.title = @"vc1";
    vc2.title = @"vc2";

    tabBarController.viewControllers = [[NSArray alloc] initWithObjects:vc1, vc2, nil];

    self.view = tabBarController.view;
}

0 个答案:

没有答案