0
votes

I placed UILabel in the cell of UITableView, connected to IBOutlet and built, but an error occurred. This is an error. "The vcMenuLabel outlet from the ViewController to the UILabel is invalid. Outlets cannot be connected to repeating content. [12]" I don't know the solution, can you tell me? Xcode12.2

import UIKit

class ViewController: UIViewController, FSCalendarDelegate, FSCalendarDataSource, FSCalendarDelegateAppearance, UITableViewDataSource, UITableViewDelegate {
    
    @IBOutlet weak var noteTableView: UITableView!
    @IBOutlet weak var vcMenuLabel: UILabel!
    
    var vcMenuValue : String?
override func viewDidLoad() {
        super.viewDidLoad()
        
        vcMenuLabel.text = vcMenuValue
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
        let vcMenuLabel = UILabel(frame: CGRect(x: 0, y: 0, width: view.frame.size.width, height: 30))
        return cell
    }
1
You put the label above the tableView? Don't you want it to be part of the tableView? Check Interface builder, it seems to have been connected to many times.Larme
I put UITableview and Cell on Storyboard, and UILabel on it. Divide into xib files?uskitm
I didn't need the Storyboard UILabel. Thank you very much.uskitm

1 Answers

0
votes

I solved it by removing the Storyboard UI Label and IBOutlet.

import UIKit

class ViewController: UIViewController, FSCalendarDelegate, FSCalendarDataSource, FSCalendarDelegateAppearance, UITableViewDataSource, UITableViewDelegate {
    
    @IBOutlet weak var noteTableView: UITableView!
    
    var vcMenuValue : String?