Im using JTAppleCalendar
-> https://github.com/patchthecode/JTAppleCalendar Calendar plugin and I want to place ColectionView Cells inside TableView cell , and I want to show there each cell inside added events with title (inside tableview cell) , but when I connecting outlets gives me;
error: Illegal Configuration: The tableView outlet from the ViewController to the UITableView is invalid. Outlets cannot be connected to repeating content.
How can I fix it ?
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)
}
}
My Screen under below;
You need to create custom class of CollectionViewCell and take IBOutlets on it. now you have taken customCell's views IBOutlets in ViewController's class.
OR
Using tag property you can link that view with cell. as below in cellForItemAtIndexPath.
let label:UILabel = cell.viewWithTag(101) as! UILabel // 101 tag need to set in storyboard related view
How to assign tag to view
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.