2017-04-24 49 views
0

进出口使用JTAppleCalendar - >https://github.com/patchthecode/JTAppleCalendar日历插件,我希望把TableView中细胞内ColectionView细胞,我想表明有添加的事件内的每个细胞与标题(的tableview细胞内),但是当我连接口让我;TableView中的JTAppleCalendar单元格?在斯威夫特3

error: Illegal Configuration: The tableView outlet from the ViewController to the UITableView is invalid. Outlets cannot be connected to repeating content.

我该如何解决?

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) 
     } 
    } 

我的屏幕;

enter image description here

+0

,如果你创建一个新的github上的问题,并上载有该问题的一小zip文件,我可以提供帮助。然后我会回到这里来回答。 –

回答

0

您需要创建自定义类CollectionViewCell的,并对其IBOutlets。现在你已经在ViewController的类中使用了customCell的视图IBOutlets。

使用标签属性,您可以将该视图链接到单元格。如下面的cellForItemAtIndexPath。

let label:UILabel = cell.viewWithTag(101) as! UILabel // 101 tag need to set in storyboard related view 

如何分配标签,查看

https://stackoverflow.com/a/31782616/3901620

+0

我添加了我的CellView.swift代码 – SwiftDeveloper

+0

然后仍然会出现此问题。 – KKRocks

+0

我添加了我的tableview代码,你可以告诉我如何修复它? – SwiftDeveloper