2017-04-24 12 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