首先,我不得不說我對於快捷和客觀的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