Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var imagesArray:[[String]] = []
- func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return imagesArray[section].count
- }
- func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
- return imagesArray.count
- }
- func insertNewRow()
- {
- self.collectionView.performBatchUpdates({ () -> Void in
- self.imagesArray.append(["Real2.jpg","cat3.jpg","Man1.png"])
- let firstIndexPath = NSIndexPath(forItem: 0, inSection: 2)
- let secondIndexPath = NSIndexPath(forItem: 1, inSection:2)
- let thirdIndexPath = NSIndexPath(forItem: 2, inSection:2)
- self.collectionView.insertSections(NSIndexSet(index: 2))
- self.collectionView.insertItemsAtIndexPaths([firstIndexPath,secondIndexPath,thirdIndexPath])
- }) { (finished) -> Void in
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement