我正在使用this来实现ContainerViewContoller
。一切正常,但我无法将数据从一个孩子ViewController
传递给另一个孩子ViewContoller
。无法将数据从一个子Viewcontoller传递到另一个子视图控制器
CouponCodeViewController *couponVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CouponCodeViewController"];
[email protected]"this is data";
couponVC.title = @"Enter Coupon Code";
[couponVC viewWillAppear:true];
CategoryViewController *categoryVC = [self.storyboard instantiateViewControllerWithIdentifier:@"CategoryViewController"];
categoryVC.title = @"Choose A Category";
YSLContainerViewController *containerVC =
[[YSLContainerViewController alloc]
initWithControllers:@[couponVC,categoryVC]
topBarHeight:statusHeight + navigationHeight
parentViewController:self];
当我打电话给我的容器ViewController
加载所有childVC在同一时间。现在我想通过对点击从CouponCodeViewController到CategoryViewController数据,但我不能这样做,因为viewDidLoad
,viewWillappear
和viewDidAppear
不叫
CouponCodeViewController我使用这是怎么回事:
- (IBAction)skipAct:(id)sender {
// CategoryViewController *category=[[CategoryViewController alloc]init];
// [email protected]"this is the data";
[self.scrollMenuDelegate scrollMenuViewSelectedIndex:1];
}
#pragma mark -- YSLContainerViewControllerDelegate
- (void)containerViewItemIndex:(NSInteger)index currentController:(UIViewController *)controller
{
[controller viewWillAppear:YES];
}
在CategoryViewController
我的viewDidLoad
和viewDidAppear
未被调用。
如何将数据从childVC传递到另一个ChildVC。
我有同样的问题...你有任何解决方案? –