我想通过UINavigationController(我使用xcode 4.3)将int变量传递给UITableView所以我创建了2个类(PartsTableViewController是“UITableViewController”和PartsNavController是“UINavigationController”) ,我想从我目前的类PartsTableViewController传递变量,然后打开该表包含标题栏的导航控制器,所以我在当前类写了下面的代码:通过UINavigationController将int变量传递给UITableView
PartsNavController *partsNav = [self.storyboard instantiateViewControllerWithIdentifier:@"partsNav"];
partsNav.groupId = myGroupp.bg_id;
[self presentModalViewController:partsNav animated:YES];
,并在PartsNavController我写在viewDidLoad中的课程:
PartsTableViewController *parts = [self.storyboard instantiateViewControllerWithIdentifier:@"Parts"];
parts.groupId = groupId;
[parts.tableView reloadData];
和PartsTableViewController我在viewDidLoad中写道:
NSLog(@"This is group: %d", groupId);
但是当运行时,它产生的输出的2倍,
This is group:1
This is group:0
第一次是我发送的值和所述第二时间它超时0,我只是想要我发送的价值,而不是0 我该如何防止这一点,并得到我发送的价值?
我想从(MaktabatyTableViewController)至(PartsTableViewController)通过,而无需使用赛格瑞
看起来你不恰当地使用子类化,当你需要子类化UINavigationController时,这是非常罕见的情况。我会为您的案例发布解决方案。 – DanSkeel
你的当前类是否在其他一些Parent NavigationController中?如果是的话,为什么不直接将新的ViewController推送到该父级导航控制器?如果您的当前类不在NavigationController中,为何不嵌入它? – DanSkeel
是的,我当前的类也是一个UITableViewController与UINavigationController连接 –