如何在Swift中使用Interface builder? [英] How do you use Interface builder with Swift?
本文介绍了如何在Swift中使用Interface builder?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将Swift代码挂钩到Storyboard时,如何添加 IBAction
和 IBOutlet
标签?
When hooking Swift code up to a Storyboard, how do you add the IBAction
and IBOutlet
tags?
推荐答案
添加 IBAction
和 IBOutlet
属性到变量和函数,以便它们可以在Interface builder中看到。
Add IBAction
and IBOutlet
attributes to variables and functions so they can be visible in Interface builder.
class ViewController: UIViewController {
@IBOutlet var label: UILabel?
@IBAction func doTap(x:UIButton) {
println("Tapped: \(x)")
}
}
这篇关于如何在Swift中使用Interface builder?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文