[英]JTAppleCalendar cell background color change error in Swift 3
[英]JTAppleCalendar cell inside TableView ? in Swift 3
我正在使用JTAppleCalendar
> https://github.com/patchthecode/JTAppleCalendar Calendar插件,我想将ColectionView Cells放置在TableView cell内,并且我想在其中显示每个带有标题的事件(在tableview cell内)内的每个cell,但是当我连接插座给了我;
错误:非法配置:从ViewController到UITableView的tableView出口无效。 插座不能连接到重复内容。
我该如何解决?
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)
}
}
我的屏幕在下面;
您需要创建CollectionViewCell的自定义类,并在其上使用IBOutlets。 现在,您已经在ViewController的类中使用了customCell的视图IBOutlets。
要么
使用标签属性,您可以将该视图与单元格链接。 如下所示在cellForItemAtIndexPath中。
let label:UILabel = cell.viewWithTag(101) as! UILabel // 101 tag need to set in storyboard related view
如何分配标签进行查看
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.