我使用JTAppleCalendar -> https://github.com/patchthecode/JTAppleCalendar日历插件,我想在TableView单元格中放置ColectionView单元格,并且我想用标题显示添加的事件中的每个单元格(在表视图单元格内),但是当我连接插座给我;
错误:非法配置: tableView从ViewController到UITableView的出口无效。插座不能连接到重复内容。
我怎么才能修好它?
CellView.swift
import JTAppleCalendar
class CellView: JTAppleCell {
@IBOutlet var selectedView: UIView!
@IBOutlet var dayLabel: UILabel!
@IBOutlet var Label: UILabel!
}Cell.Swift
import UIKit
class Cell: UITableViewCell {
@IBOutlet weak var label : UILabel!
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}ViewController.Swift
@IBOutlet weak var tableView: UITableView!
extension ViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! Cell
cell.label?.text = String(indexPath.row)
return cell
}
func tableView(_ tableView: UITableView,didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
}
}下面是我的屏幕;

发布于 2017-04-24 13:55:42
您需要创建CollectionViewCell的自定义类并在其上使用IBOutlets。现在,您已经在ViewController类中使用了customCell的视图IBOutlets。
或
使用tag属性,您可以将该视图与单元格链接。如下面在cellForItemAtIndexPath中所示。
let label:UILabel = cell.viewWithTag(101) as! UILabel // 101 tag need to set in storyboard related view 如何为查看分配标记
https://stackoverflow.com/questions/43589925
复制相似问题