我正在尝试在UITextView IBOutlet
变量上编写自定义文本。但是,由于某些原因编译器说值为零?我检查了插座连接。他们看起来很好。我错过了别的东西。有人可以帮我这个吗?
import Foundation
import UIKit
class CellClickController: UIViewController{
@IBOutlet var name: UITextView!
//var urgentCenter: UrgentCenterDetails = UrgentCenterDetails()
func viewDidLoad(index: Int) {
super.viewDidLoad()
//println("index: \(index)")
if name == nil{
println("I am nil")
}
else{
name.text = "Hello"
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
答案 0 :(得分:0)
试试这个,
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
if name == nil{
println("I am nil")
}
else{
name.text = "Hello"
}
}
在您的代码中,viewDidLoad
方法的语法错误,因此func
viewDidLoad
无效。