0
我需要刷新集合視圖時,從另一個視圖segue,但它不起作用,它永遠不會進入collectionView func?我在這裏做錯了什麼嗎?謝謝在CollectionView中刷新數據不起作用Swift
class AddViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
@IBOutlet weak var titleTextField: UITextField!
@IBOutlet weak var notesTextView: UITextView!
@IBOutlet weak var exerciseName: UILabel!
var collectionView: UICollectionView?
var listOfExerciseItems:NSMutableArray = NSMutableArray()
override func viewDidAppear(animated: Bool) {
self.collectionView?.reloadData()
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return listOfExerciseItems.count
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell:colvwCell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as colvwCell
cell.exerciseName.text = listOfExerciseItems[indexPath.row] as String
return cell
}