Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. var imagesArray:[[String]] = []
  2.  
  3. func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  4. return imagesArray[section].count
  5. }
  6.  
  7. func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
  8.  
  9. return imagesArray.count
  10. }
  11.  
  12. func insertNewRow()
  13. {
  14. self.collectionView.performBatchUpdates({ () -> Void in
  15.  
  16. self.imagesArray.append(["Real2.jpg","cat3.jpg","Man1.png"])
  17.  
  18. let firstIndexPath = NSIndexPath(forItem: 0, inSection: 2)
  19. let secondIndexPath = NSIndexPath(forItem: 1, inSection:2)
  20. let thirdIndexPath = NSIndexPath(forItem: 2, inSection:2)
  21. self.collectionView.insertSections(NSIndexSet(index: 2))
  22. self.collectionView.insertItemsAtIndexPaths([firstIndexPath,secondIndexPath,thirdIndexPath])
  23.  
  24. }) { (finished) -> Void in
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement