Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/DeveloperLx/LxGridView-swift
Imitation iOS system desktop icon arrangement and interaction by UICollectionView!
https://github.com/DeveloperLx/LxGridView-swift
Last synced: 16 days ago
JSON representation
Imitation iOS system desktop icon arrangement and interaction by UICollectionView!
- Host: GitHub
- URL: https://github.com/DeveloperLx/LxGridView-swift
- Owner: DeveloperLx
- License: apache-2.0
- Created: 2015-06-30T15:59:38.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-02T02:16:46.000Z (over 9 years ago)
- Last Synced: 2024-08-01T08:06:53.175Z (3 months ago)
- Language: Swift
- Homepage:
- Size: 9.56 MB
- Stars: 162
- Watchers: 10
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LxGridView-swift
Imitate Apple iOS system Desktop icons arrangement and interaction by inheriting UICollectionView!* ![demo](demo.gif)
---
### Installation
You only need drag directory LxGridView to your project.
### Support
Minimum support iOS version: iOS 6.0
### Usage`You can use LxGridView as convenient as UICollectionView.`
let _gridViewFlowLayout = LxGridViewFlowLayout()
// ... config _gridViewFlowLayout
_gridView = LxGridView(frame: GRIDVIEW_FRAME, collectionViewLayout: _gridViewFlowLayout)
// ... congif _gridView
_gridView.registerClass(LxGridViewCell.classForCoder(), forCellWithReuseIdentifier: GRIDVIEW_CELL_REUSE_IDENTIFIER)// implement delegate method
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return dataArray.count
}
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(LxGridViewCellReuseIdentifier, forIndexPath: indexPath) as! LxGridViewCell
cell.delegate = self
cell.editing = _gridView.editing
// ... config cell
return cell
}func collectionView(collectionView: LxGridView, itemAtIndexPath sourceIndexPath: NSIndexPath, willMoveToIndexPath destinationIndexPath: NSIndexPath) {
let dataDict = dataArray[sourceIndexPath.item]
dataArray.removeAtIndex(sourceIndexPath.item)
dataArray.insert(dataDict, atIndex: destinationIndexPath.item)
}
func deleteButtonClickedInGridViewCell(gridViewCell: LxGridViewCell) {if let gridViewCellIndexPath = _gridView!.indexPathForCell(gridViewCell) {
dataArray.removeAtIndex(gridViewCellIndexPath.item)
_gridView.performBatchUpdates({ [unowned self] () -> Void in
self._gridView.deleteItemsAtIndexPaths([gridViewCellIndexPath])
}, completion: nil)
}
}---
### License
LxGridView is available under the Apache License 2.0. See the LICENSE file for more info.