我在这个问题中遇到了同样的错误:我如何访问另一个类中的 IBOutlet?迅速 https://stackoverflow.com/questions/35358225/how-can-i-access-iboutlet-in-another-class-in-swift但是当我在 Xcode 中写入时(对于带有 Swift 3 的 iOS 8),我遇到了错误。
我的代码是这样的。我要编辑amauntOut
(is an UILabel
)在课堂上Convert_Table_Third_Cell
只需一键操作:
@IBAction func actionTextb(_ sender: Any) {
print("you writted \(String(describing: amauntEnter.text!))----")
//Convert_Table_Third_Cell.amauntOut.text = amauntEnter.text ----> is a tried
//var dash : abcViewController = storyBoard.instantiateViewControllerWithIdentifier("abc") as! abcViewController ----> is a tried
//var a = dash.getXYZ() ----> is a tried
var update: Convert_Table_Third_Cell = UIStoryboard.instantiateViewController(UIStoryboard) as! Convert_Table_Third_Cell
update.amauntOut.text = "hola"
}
我收到此错误:
实例成员“instantiateViewController”不能用于类型“UIStoryboard”;您的意思是使用这种类型的值吗?
有人能帮我吗?
这是第一堂课
import UIKit
class Convert_Table_Second_Cell: UITableViewCell {
@IBOutlet var amauntEnter: UITextField!
var theNumber = getTheNumber()
@IBAction func actionTextb(_ sender: Any) {
print("you writted \(String(describing: amauntEnter.text!))----")
let storyboard = UIStoryboard.init(name: "convert ID", bundle: nil)
let update = storyboard.instantiateViewController(withIdentifier: "convert ID") as! Convert_Table_Third_Cell
update.amauntOut.text = "hola"
let aa = "hola hillel----------------------"
print(aa)
print(theNumber.usedParameters(ArrayOfNumbers: unitInOutlet, TipOfData: 3))
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
print("this is the valeu \(theNumber.hola)")
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
这是第二个我要编辑的标签
导入 UIKit
类 Convert_Table_Third_Cell: UITableViewCell {
@IBOutlet var amauntOut: UILabel!
@IBOutlet var UnityMeasurment: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}