2017-07-03 64 views

回答

0

通常,是的。但那取决于。您可以使用NotificationCenter,您可以使用“准备”功能。代表是这里最常用的选项。你的情况:

protocol ChangeButtonColorDelegate { 
    func changeButtonColor() 
} 

class VC1 : ChangeButtonColorDelegate... { 
    func changeButtonColor() { 
     /* change button color here */ 
    } 

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 
     if (segue.identifier == "goto_vc2") { 
      (segue.dest as! VC2).delegate = self 
     } 
    } 
} 

class VC2 : ... { 
    var delegate : ChangeButtonColorDelegate! 
} 
+0

非常感谢。它清除了我的一切:)清除和快速! – motivated

+0

请将此答案标记为正确答案:) – chr0x

+0

其柜台下方的复选标记 – chr0x

相关问题