문제

i've developed a ViewController that shows different data according to input parameter; i would like to use a tabBar interface and call the same ViewController from different tabs by passing them different parameters. Can i do this? I actually get errors if i specify the ViewController's NIB in tabBar item.

Can you help me please? Thanks in advance c.

도움이 되었습니까?

해결책

Create two different instances of your ViewController:

MyViewController *vc1 = [[MyViewController alloc] initWithNib:@"MyViewController" bundle:nil];
MyViewController *vc2 = [[MyViewController alloc] initWithNib:@"MyViewController" bundle:nil];

UITabBarController *tabs = [[UITabBarController alloc] init];
[tabs setViewControllers:[NSArray arrayWithObjects:vc1, vc2, nil] animated:NO];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top