在父UiViewController上执行方法

时间:2011-08-08 02:57:57

标签: iphone objective-c cocoa-touch

从一个UIViewController我拨打另一个UIViewController

FullScreenViewController *anotherViewController = [[FullScreenViewController alloc] initWithNibName:@"FullScreenViewController" bundle:nil];

UIView *theWindow = [currentView superview];

[theWindow addSubview:newView];

在打开的FullScreenViewController上,我想在父UIButton内调用UIViewController来调用方法。

有办法吗?我该怎么办?

由于

1 个答案:

答案 0 :(得分:0)

您可以在构建期间(通过在父级中传入self)将未获取的引用传递给子视图控制器,孩子可以使用它来调用其父级的方法。

更好的是,你可以让父母成为孩子的代表: How do I create delegates in Objective-C?