So, I'm trying to use an iboutlet from a different screen in a tableview. Whenever I try to drag it out from the screen, it connects it as an ibaction. I tried to look at this question, Label Text cannot connect IBOutlet in Table View but I wasn't able to make sense of it or the answer.
I am trying for something like this:
class aRandomTable: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var some_label: UITextView!
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cellReuseIdentifier")! //1.
let text = data[indexPath.row] //2.
cell.textLabel?.text = text //3.
return cell //4.
}
func use_text_view(){
if(some_label != ""){
//generate an array so that I can use it in the table
}
}
Comments
Post a Comment