我将UILabel放置在UITableView的单元格中,连接到IBOutlet并构建,但发生了错误。这是一个错误。"从ViewController到UILabel的vcMenuLabel出口无效。出口无法连接到重复内容。[12] ";我不知道解决办法,你能告诉我吗?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
}
我通过删除Storyboard UI标签和IBOutlet解决了这个问题。
import UIKit
class ViewController: UIViewController, FSCalendarDelegate, FSCalendarDataSource, FSCalendarDelegateAppearance, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var noteTableView: UITableView!
var vcMenuValue : String?