首先,我不得不说我对于快捷和客观的C是非常新的。我正在自己学习。为什么要将viewController作为变量传递?
我有一个问题,这个代码
我有我的SettingViewController称为“settingsViewControllerFinished”,它通过对整个控为变量的代表。 了这样的代码:
我SettingViewController.swiftprotocol SettingViewControllerDelegate: class {
func settingsViewControllerFinished(settingsViewController: SettingsViewController)
}
@IBAction func close(sender: AnyObject) {
dismissViewControllerAnimated(true, completion: nil)
self.delegate?.settingsViewControllerFinished(self)
}
我confused.What你的意思是,如果你通过整个控制器一个变量?(也许这个问题很愚蠢)
在我的viewController:
func settingsViewControllerFinished(settingsViewController: SettingsViewController)
{
self.brushWidth = settingsViewController.brush
self.opacity = settingsViewController.opacity
self.red = settingsViewController.red
self.green = settingsViewController.green
self.blue = settingsViewController.blue
}
我猜的理由是:我通过一切SettingViewController到视图控制器,这样我可以在SettingViewController使用的变量。
我是否是rihgt?
谢谢你我的朋友! – iceChao