我有一个函数ViewController
,我想从一个UIButton在ProfileViewController
执行。我将如何做到这一点?以下是我尝试过的代码。为另一个ViewController执行功能
守则ViewController
func hideProfileButton (sender:AnyObject) {
self.profileButtonOutlet.hidden = true
}
守则ProfileViewController
ViewController.hideProfileButton(self)
该通知自你调用该方法是一个实例方法,你需要得到一个指向视图控制器的实例您已拥有,或使用委托协议。你不能在课堂上调用该方法。 – rdelmar 2014-12-13 00:39:01