【发布时间】:2014-04-21 21:21:03
【问题描述】:
我在从一个UIViewController 调用另一个UIViewController 的方法时遇到问题。
目前我有两个UIViewControllers 的UIScroll 视图。
我想在第二个中更改一些内容并在第一个中查看结果。
我尝试这样做:
第二个UIViewController的内部函数:
-(void)doSomething:(){
FirsOneViewController *firstVC = [FirsOneViewController alloc] init];
[firstVC changeUnits:0];
}
函数被调用,但我在第一个控制器中没有看到任何变化。
BR, 保罗
【问题讨论】:
-
那是因为你重新创建了你的第一个 vc 而不是持有他的弱属性...
-
你在使用故事板吗??
-
是的。[self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"VCone"]]; [self addChildViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"VCtwo"]];
标签: ios objective-c uiviewcontroller uiscrollview