我以编程方式添加了一个 UITabBarController(搜索,登录),我想设置第二个 tabbaritem(登录),并在登录凭据不正确时选择它的视图。但我无法这样做..不明白我在哪里出错了..?
Search *first = [[Search alloc] initWithNibName:@"Search" bundle:nil];
first.title=@"Search";
Login *second=[[Login alloc]initWithNibName:@"Login" bundle:nil];
second.title=@"Login";
NSArray *viewArray= [NSArray arrayWithObjects:first,second, nil];
tabBarController=[[UITabBarController alloc] init];
[tabBarController setViewControllers:viewArray animated:NO];
[tabBarController setSelectedIndex:2];
[self presentModalViewController:tabBarController animated:NO];
但是在这里我的 SearchViewController 被选中并显示为默认值......我哪里出错了......?