├── .gitignore ├── LICENSE ├── LxGridView ├── LxGridView.swift ├── LxGridViewCell.swift └── LxGridViewFlowLayout.swift ├── LxGridViewDemo ├── LxGridViewDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── LxGridViewDemo │ ├── AppDelegate.swift │ ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard │ ├── Images.xcassets │ ├── 0.imageset │ │ ├── 0.png │ │ ├── 0@2x.png │ │ └── Contents.json │ ├── 1.imageset │ │ ├── 1.png │ │ ├── 1@2x.png │ │ └── Contents.json │ ├── 10.imageset │ │ ├── 10.png │ │ ├── 10@2x.png │ │ └── Contents.json │ ├── 11.imageset │ │ ├── 11.png │ │ ├── 11@2x.png │ │ └── Contents.json │ ├── 12.imageset │ │ ├── 12.png │ │ ├── 12@2x.png │ │ └── Contents.json │ ├── 13.imageset │ │ ├── 13.png │ │ ├── 13@2x.png │ │ └── Contents.json │ ├── 14.imageset │ │ ├── 14.png │ │ ├── 14@2x.png │ │ └── Contents.json │ ├── 15.imageset │ │ ├── 15.png │ │ ├── 15@2x.png │ │ └── Contents.json │ ├── 16.imageset │ │ ├── 16.png │ │ ├── 16@2x.png │ │ └── Contents.json │ ├── 17.imageset │ │ ├── 17.png │ │ ├── 17@2x.png │ │ └── Contents.json │ ├── 18.imageset │ │ ├── 18.png │ │ ├── 18@2x.png │ │ └── Contents.json │ ├── 19.imageset │ │ ├── 19.png │ │ ├── 19@2x.png │ │ └── Contents.json │ ├── 2.imageset │ │ ├── 2.png │ │ ├── 2@2x.png │ │ └── Contents.json │ ├── 20.imageset │ │ ├── 20.png │ │ ├── 20@2x.png │ │ └── Contents.json │ ├── 21.imageset │ │ ├── 21.png │ │ ├── 21@2x.png │ │ └── Contents.json │ ├── 22.imageset │ │ ├── 22.png │ │ ├── 22@2x.png │ │ └── Contents.json │ ├── 23.imageset │ │ ├── 23.png │ │ ├── 23@2x.png │ │ └── Contents.json │ ├── 24.imageset │ │ ├── 24.png │ │ ├── 24@2x.png │ │ └── Contents.json │ ├── 25.imageset │ │ ├── 25.png │ │ ├── 25@2x.png │ │ └── Contents.json │ ├── 26.imageset │ │ ├── 26.png │ │ ├── 26@2x.png │ │ └── Contents.json │ ├── 27.imageset │ │ ├── 27.png │ │ ├── 27@2x.png │ │ └── Contents.json │ ├── 28.imageset │ │ ├── 28.png │ │ ├── 28@2x.png │ │ └── Contents.json │ ├── 29.imageset │ │ ├── 29.png │ │ ├── 29@2x.png │ │ └── Contents.json │ ├── 3.imageset │ │ ├── 3.png │ │ ├── 3@2x.png │ │ └── Contents.json │ ├── 30.imageset │ │ ├── 30.png │ │ ├── 30@2x.png │ │ └── Contents.json │ ├── 4.imageset │ │ ├── 4.png │ │ ├── 4@2x.png │ │ └── Contents.json │ ├── 5.imageset │ │ ├── 5.png │ │ ├── 5@2x.png │ │ └── Contents.json │ ├── 6.imageset │ │ ├── 6.png │ │ ├── 6@2x.png │ │ └── Contents.json │ ├── 7.imageset │ │ ├── 7.png │ │ ├── 7@2x.png │ │ └── Contents.json │ ├── 8.imageset │ │ ├── 8.png │ │ ├── 8@2x.png │ │ └── Contents.json │ ├── 9.imageset │ │ ├── 9.png │ │ ├── 9@2x.png │ │ └── Contents.json │ ├── AppIcon-1.appiconset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── LaunchImage.launchimage │ │ └── Contents.json │ └── delete_collect_btn.imageset │ │ ├── Contents.json │ │ ├── delete_collect_btn.png │ │ └── delete_collect_btn@2x.png │ ├── Info.plist │ └── ViewController.swift ├── README.md └── demo.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /LxGridView/LxGridView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LxGridView.swift 3 | // LxGridViewDemo 4 | // 5 | 6 | import UIKit 7 | 8 | class LxGridView: UICollectionView { 9 | 10 | private var _editing = false 11 | 12 | var editing: Bool { 13 | 14 | get { 15 | return _editing 16 | } 17 | set { 18 | _editing = newValue 19 | for cell in visibleCells() { 20 | 21 | if cell is LxGridViewCell { 22 | 23 | let gridViewCell = cell as! LxGridViewCell 24 | gridViewCell.editing = newValue 25 | } 26 | else { 27 | assert(false, "LxGridView: Must use LxGridViewCell as your collectionViewCell class!") 28 | } 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LxGridView/LxGridViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LxGridViewCell.swift 3 | // LxGridViewDemo 4 | // 5 | 6 | import UIKit 7 | 8 | let LxGridView_DELETE_RADIUS: CGFloat = 15 9 | let ICON_CORNER_RADIUS: CGFloat = 15 10 | 11 | let kVibrateAnimation = "kVibrateAnimation" 12 | let VIBRATE_DURATION: CGFloat = 0.1 13 | let VIBRATE_RADIAN = CGFloat(M_PI/96) 14 | 15 | protocol LxGridViewCellDelegate { 16 | 17 | func deleteButtonClickedInGridViewCell(gridViewCell: LxGridViewCell) 18 | } 19 | 20 | class LxGridViewCell: UICollectionViewCell { 21 | 22 | var delegate: LxGridViewCellDelegate? 23 | var iconImageView: UIImageView? 24 | 25 | private var _deleteButton: UIButton? 26 | private var _titleLabel: UILabel? 27 | 28 | override init(frame: CGRect) { 29 | 30 | super.init(frame: frame) 31 | setup() 32 | setupEvents() 33 | } 34 | 35 | required init(coder aDecoder: NSCoder) { 36 | 37 | super.init(coder: aDecoder) 38 | setup() 39 | setupEvents() 40 | } 41 | 42 | func setup() { 43 | iconImageView = UIImageView() 44 | iconImageView?.contentMode = .ScaleAspectFit 45 | iconImageView?.layer.cornerRadius = ICON_CORNER_RADIUS 46 | iconImageView?.layer.masksToBounds = true 47 | contentView.addSubview(iconImageView!) 48 | 49 | _deleteButton = UIButton.buttonWithType(.Custom) as? UIButton 50 | _deleteButton?.setImage(UIImage(named: "delete_collect_btn"), forState: .Normal) 51 | contentView.addSubview(_deleteButton!) 52 | _deleteButton?.hidden = true 53 | 54 | _titleLabel = UILabel() 55 | _titleLabel?.text = "title" 56 | _titleLabel?.font = UIFont.systemFontOfSize(14) 57 | _titleLabel?.textColor = UIColor.blackColor() 58 | _titleLabel?.textAlignment = .Center 59 | contentView.addSubview(_titleLabel!) 60 | 61 | iconImageView?.setTranslatesAutoresizingMaskIntoConstraints(false) 62 | _deleteButton?.setTranslatesAutoresizingMaskIntoConstraints(false) 63 | _titleLabel?.setTranslatesAutoresizingMaskIntoConstraints(false) 64 | } 65 | 66 | override func layoutSubviews() { 67 | 68 | super.layoutSubviews() 69 | 70 | let iconImageViewLeftConstraint = NSLayoutConstraint(item: iconImageView!, attribute: .Left, relatedBy: .Equal, toItem: contentView, attribute: .Left, multiplier: 1, constant: 0) 71 | let iconImageViewRightConstraint = NSLayoutConstraint(item: iconImageView!, attribute: .Right, relatedBy: .Equal, toItem: contentView, attribute: .Right, multiplier: 1, constant: 0) 72 | let iconImageViewTopConstraint = NSLayoutConstraint(item: iconImageView!, attribute: .Top, relatedBy: .Equal, toItem: contentView, attribute: .Top, multiplier: 1, constant: 0) 73 | let iconImageViewHeightConstraint = NSLayoutConstraint(item: iconImageView!, attribute: .Width, relatedBy: .Equal, toItem: iconImageView, attribute: .Height, multiplier: 1, constant: 0) 74 | contentView.addConstraints([iconImageViewLeftConstraint, iconImageViewRightConstraint, iconImageViewTopConstraint, iconImageViewHeightConstraint]) 75 | 76 | let deleteButtonTopConstraint = NSLayoutConstraint(item: _deleteButton!, attribute: .Top, relatedBy: .Equal, toItem: iconImageView, attribute: .Top, multiplier: 1, constant: -_deleteButton!.currentImage!.size.height/2) 77 | let deleteButtonLeftConstraint = NSLayoutConstraint(item: _deleteButton!, attribute: .Left, relatedBy: .Equal, toItem: iconImageView, attribute: .Left, multiplier: 1, constant: -_deleteButton!.currentImage!.size.width/2) 78 | let deleteButtonWidthConstraint = NSLayoutConstraint(item: _deleteButton!, attribute: .Width, relatedBy: .Equal, toItem: nil, attribute: .Width, multiplier: 1, constant: _deleteButton!.currentImage!.size.width) 79 | let deleteButtonHeightConstraint = NSLayoutConstraint(item: _deleteButton!, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .Height, multiplier: 1, constant: _deleteButton!.currentImage!.size.height) 80 | contentView.addConstraints([deleteButtonTopConstraint, deleteButtonLeftConstraint, deleteButtonWidthConstraint, deleteButtonHeightConstraint]) 81 | 82 | let centerXConstraint = NSLayoutConstraint(item: _titleLabel!, attribute: .CenterX, relatedBy: .Equal, toItem: iconImageView, attribute: .CenterX, multiplier: 1, constant: 0) 83 | let titleLabelTopConstraint = NSLayoutConstraint(item: _titleLabel!, attribute: .Top, relatedBy: .Equal, toItem: iconImageView, attribute: .Bottom, multiplier: 1, constant: 5) 84 | let titleLabelWidthConstraint = NSLayoutConstraint(item: _titleLabel!, attribute: .Width, relatedBy: .Equal, toItem: iconImageView, attribute: .Width, multiplier: 1, constant: 0) 85 | let titleLabelHeightConstraint = NSLayoutConstraint(item: _titleLabel!, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .Height, multiplier: 1, constant: 15) 86 | contentView.addConstraints([centerXConstraint, titleLabelTopConstraint, titleLabelWidthConstraint, titleLabelHeightConstraint]) 87 | } 88 | 89 | func setupEvents() { 90 | 91 | _deleteButton?.addTarget(self, action: Selector("deleteButtonClicked:"), forControlEvents: .TouchUpInside) 92 | iconImageView?.userInteractionEnabled = true 93 | } 94 | 95 | func deleteButtonClicked(btn: UIButton) { 96 | 97 | self.delegate?.deleteButtonClickedInGridViewCell(self) 98 | } 99 | 100 | private var vibrating: Bool { 101 | 102 | get { 103 | if let animationKeys = iconImageView?.layer.animationKeys() { 104 | 105 | return contains(animationKeys as! [String], kVibrateAnimation) 106 | } 107 | else { 108 | return false 109 | } 110 | } 111 | set { 112 | 113 | var _vibrating = false 114 | 115 | if let animationKeys = layer.animationKeys() { 116 | 117 | _vibrating = contains(animationKeys as! [String], kVibrateAnimation) 118 | } 119 | else { 120 | _vibrating = false 121 | } 122 | 123 | if _vibrating && !newValue { 124 | 125 | layer.removeAnimationForKey(kVibrateAnimation) 126 | } 127 | else if !_vibrating && newValue { 128 | 129 | let vibrateAnimation = CABasicAnimation(keyPath: "transform.rotation.z") 130 | vibrateAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) 131 | vibrateAnimation.fromValue = -VIBRATE_RADIAN 132 | vibrateAnimation.toValue = VIBRATE_RADIAN 133 | vibrateAnimation.autoreverses = true 134 | vibrateAnimation.duration = CFTimeInterval(VIBRATE_DURATION) 135 | vibrateAnimation.repeatCount = Float(CGFloat.max) 136 | layer.addAnimation(vibrateAnimation, forKey: kVibrateAnimation) 137 | } 138 | } 139 | } 140 | 141 | var editing: Bool { 142 | 143 | get { 144 | return vibrating 145 | } 146 | set { 147 | vibrating = newValue 148 | _deleteButton?.hidden = !newValue 149 | } 150 | } 151 | 152 | var title: String? { 153 | 154 | get { 155 | return _titleLabel?.text 156 | } 157 | set { 158 | _titleLabel?.text = newValue 159 | } 160 | } 161 | 162 | func snapshotView() -> UIView { 163 | 164 | let snapshotView = UIView() 165 | 166 | let cellSnapshotView = snapshotViewAfterScreenUpdates(false) 167 | let deleteButtonSnapshotView = _deleteButton?.snapshotViewAfterScreenUpdates(false) 168 | 169 | snapshotView.frame = CGRect(x: -deleteButtonSnapshotView!.frame.size.width / 2, 170 | y: -deleteButtonSnapshotView!.frame.size.height / 2, 171 | width: deleteButtonSnapshotView!.frame.size.width / 2 + cellSnapshotView.frame.size.width, 172 | height: deleteButtonSnapshotView!.frame.size.height / 2 + cellSnapshotView.frame.size.height) 173 | cellSnapshotView.frame = CGRect(x: deleteButtonSnapshotView!.frame.size.width / 2, 174 | y: deleteButtonSnapshotView!.frame.size.height / 2, 175 | width: cellSnapshotView.frame.size.width, 176 | height: cellSnapshotView.frame.size.height) 177 | deleteButtonSnapshotView?.frame = CGRect(x: 0, y: 0, 178 | width: deleteButtonSnapshotView!.frame.size.width, 179 | height: deleteButtonSnapshotView!.frame.size.height) 180 | 181 | snapshotView.addSubview(cellSnapshotView) 182 | snapshotView.addSubview(deleteButtonSnapshotView!) 183 | 184 | return snapshotView 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /LxGridView/LxGridViewFlowLayout.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LxGridViewFlowLayout.swift 3 | // LxGridViewDemo 4 | // 5 | 6 | import UIKit 7 | 8 | let PRESS_TO_MOVE_MIN_DURATION = 0.1 9 | let MIN_PRESS_TO_BEGIN_EDITING_DURATION = 0.6 10 | 11 | @objc 12 | 13 | protocol LxGridViewDataSource : UICollectionViewDataSource { 14 | 15 | optional func collectionView(collectionView: LxGridView, itemAtIndexPath sourceIndexPath: NSIndexPath, willMoveToIndexPath destinationIndexPath: NSIndexPath) 16 | optional func collectionView(collectionView: LxGridView, itemAtIndexPath sourceIndexPath: NSIndexPath, didMoveToIndexPath destinationIndexPath: NSIndexPath) 17 | 18 | optional func collectionView(collectionView: LxGridView, canMoveItemAtIndexPath indexPath: NSIndexPath) -> Bool 19 | optional func collectionView(collectionView: LxGridView, itemAtIndexPath sourceIndexPath: NSIndexPath, canMoveToIndexPath destinationIndexPath: NSIndexPath) -> Bool 20 | } 21 | 22 | @objc 23 | 24 | protocol LxGridViewDelegateFlowLayout : UICollectionViewDelegateFlowLayout { 25 | 26 | optional func collectionView(collectionView: LxGridView, layout gridViewLayout: LxGridViewFlowLayout, willBeginDraggingItemAtIndexPath indexPath: NSIndexPath) 27 | optional func collectionView(collectionView: LxGridView, layout gridViewLayout: LxGridViewFlowLayout, didBeginDraggingItemAtIndexPath indexPath: NSIndexPath) 28 | optional func collectionView(collectionView: LxGridView, layout gridViewLayout: LxGridViewFlowLayout, willEndDraggingItemAtIndexPath indexPath: NSIndexPath) 29 | optional func collectionView(collectionView: LxGridView, layout gridViewLayout: LxGridViewFlowLayout, didEndDraggingItemAtIndexPath indexPath: NSIndexPath) 30 | } 31 | 32 | class LxGridViewFlowLayout: UICollectionViewFlowLayout, UIGestureRecognizerDelegate { 33 | 34 | var panGestureRecognizerEnable: Bool { 35 | 36 | get { 37 | return _panGestureRecognizer.enabled 38 | } 39 | set { 40 | _panGestureRecognizer.enabled = newValue 41 | } 42 | } 43 | 44 | var _panGestureRecognizer = UIPanGestureRecognizer() 45 | 46 | var _longPressGestureRecognizer = UILongPressGestureRecognizer() 47 | var _movingItemIndexPath: NSIndexPath? 48 | var _beingMovedPromptView: UIView? 49 | var _sourceItemCollectionViewCellCenter = CGPointZero 50 | 51 | var _displayLink: CADisplayLink? 52 | var _remainSecondsToBeginEditing = MIN_PRESS_TO_BEGIN_EDITING_DURATION 53 | 54 | 55 | // MARK:- setup 56 | deinit { 57 | 58 | _displayLink?.invalidate() 59 | 60 | removeGestureRecognizers() 61 | removeObserver(self, forKeyPath: "collectionView") 62 | } 63 | 64 | override init () { 65 | 66 | super.init() 67 | setup() 68 | } 69 | 70 | required init(coder aDecoder: NSCoder) { 71 | 72 | super.init(coder: aDecoder) 73 | setup() 74 | } 75 | 76 | func setup() { 77 | 78 | self.addObserver(self, forKeyPath: "collectionView", options: .New, context: nil) 79 | } 80 | 81 | func addGestureRecognizers() { 82 | 83 | collectionView?.userInteractionEnabled = true 84 | 85 | _longPressGestureRecognizer.addTarget(self, action: Selector("longPressGestureRecognizerTriggerd:")) 86 | _longPressGestureRecognizer.cancelsTouchesInView = false 87 | _longPressGestureRecognizer.minimumPressDuration = PRESS_TO_MOVE_MIN_DURATION 88 | _longPressGestureRecognizer.delegate = self 89 | 90 | if let cV = collectionView { 91 | 92 | for gestureRecognizer in cV.gestureRecognizers! { 93 | 94 | if gestureRecognizer is UILongPressGestureRecognizer { 95 | 96 | gestureRecognizer.requireGestureRecognizerToFail(_longPressGestureRecognizer) 97 | } 98 | } 99 | } 100 | 101 | collectionView?.addGestureRecognizer(_longPressGestureRecognizer) 102 | 103 | _panGestureRecognizer.addTarget(self, action: Selector("panGestureRecognizerTriggerd:")) 104 | _panGestureRecognizer.delegate = self 105 | collectionView?.addGestureRecognizer(_panGestureRecognizer) 106 | 107 | NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("applicationWillResignActive:"), name: UIApplicationWillResignActiveNotification, object: nil) 108 | } 109 | 110 | func removeGestureRecognizers() { 111 | 112 | _longPressGestureRecognizer.view?.removeGestureRecognizer(_longPressGestureRecognizer) 113 | _longPressGestureRecognizer.delegate = nil 114 | 115 | _panGestureRecognizer.view?.removeGestureRecognizer(_panGestureRecognizer) 116 | _panGestureRecognizer.delegate = nil 117 | 118 | NSNotificationCenter.defaultCenter().removeObserver(self, forKeyPath: UIApplicationWillResignActiveNotification) 119 | } 120 | 121 | // MARK:- getter and setter implementation 122 | var dataSource: LxGridViewDataSource? { 123 | 124 | return collectionView?.dataSource as? LxGridViewDataSource 125 | } 126 | 127 | var delegate: LxGridViewDelegateFlowLayout? { 128 | 129 | return collectionView?.delegate as? LxGridViewDelegateFlowLayout 130 | } 131 | 132 | var editing: Bool { 133 | 134 | set { 135 | assert(collectionView is LxGridView || collectionView == nil, "LxGridViewFlowLayout: Must use LxGridView as your collectionView class!") 136 | 137 | if let gridView = collectionView as? LxGridView { 138 | 139 | gridView.editing = newValue 140 | } 141 | } 142 | get { 143 | assert(collectionView is LxGridView || collectionView == nil, "LxGridViewFlowLayout: Must use LxGridView as your collectionView class!") 144 | 145 | if let gridView = collectionView as? LxGridView { 146 | 147 | return gridView.editing 148 | } 149 | else { 150 | return false 151 | } 152 | } 153 | } 154 | 155 | // MARK:- override UICollectionViewLayout methods 156 | override func layoutAttributesForElementsInRect(rect: CGRect) -> [AnyObject]? { 157 | 158 | let layoutAttributesForElementsInRect = super.layoutAttributesForElementsInRect(rect) 159 | 160 | if let lxfeir = layoutAttributesForElementsInRect { 161 | 162 | for layoutAttributes in lxfeir { 163 | 164 | if let las = layoutAttributes as? UICollectionViewLayoutAttributes { 165 | 166 | if las.representedElementCategory == .Cell { 167 | 168 | las.hidden = las.indexPath == _movingItemIndexPath 169 | } 170 | } 171 | } 172 | } 173 | 174 | return layoutAttributesForElementsInRect 175 | } 176 | 177 | override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes! { 178 | 179 | let layoutAttributes = super.layoutAttributesForItemAtIndexPath(indexPath) 180 | 181 | if layoutAttributes.representedElementCategory == .Cell { 182 | 183 | layoutAttributes.hidden = layoutAttributes.indexPath == _movingItemIndexPath 184 | } 185 | 186 | return layoutAttributes 187 | } 188 | 189 | // MARK:- gesture 190 | func longPressGestureRecognizerTriggerd(longPress:UILongPressGestureRecognizer) { 191 | 192 | switch longPress.state { 193 | 194 | case .Began: 195 | if _displayLink == nil { 196 | _displayLink = CADisplayLink(target: self, selector: Selector("displayLinkTriggered:")) 197 | _displayLink?.frameInterval = 6 198 | _displayLink?.addToRunLoop(NSRunLoop.currentRunLoop(), forMode: NSDefaultRunLoopMode) 199 | 200 | _remainSecondsToBeginEditing = MIN_PRESS_TO_BEGIN_EDITING_DURATION 201 | } 202 | 203 | if editing == false { 204 | 205 | return 206 | } 207 | 208 | _movingItemIndexPath = collectionView?.indexPathForItemAtPoint(longPress.locationInView(collectionView)) 209 | 210 | if dataSource?.collectionView?(collectionView as! LxGridView, canMoveItemAtIndexPath: _movingItemIndexPath!) == false { 211 | 212 | _movingItemIndexPath = nil 213 | return 214 | } 215 | 216 | delegate?.collectionView?(collectionView as! LxGridView, layout: self, willBeginDraggingItemAtIndexPath: _movingItemIndexPath!) 217 | 218 | if _movingItemIndexPath == nil { 219 | 220 | return 221 | } 222 | 223 | let sourceCollectionViewCell = collectionView?.cellForItemAtIndexPath(_movingItemIndexPath!) 224 | 225 | assert(sourceCollectionViewCell is LxGridViewCell || sourceCollectionViewCell == nil, "LxGridViewFlowLayout: Must use LxGridViewCell as your collectionViewCell class!") 226 | 227 | let sourceGridViewCell = sourceCollectionViewCell as! LxGridViewCell 228 | 229 | _beingMovedPromptView = UIView(frame: CGRectOffset(sourceCollectionViewCell!.frame, -LxGridView_DELETE_RADIUS, -LxGridView_DELETE_RADIUS)) 230 | 231 | sourceGridViewCell.highlighted = true 232 | let highlightedSnapshotView = sourceGridViewCell.snapshotView() 233 | highlightedSnapshotView.frame = sourceGridViewCell.bounds 234 | highlightedSnapshotView.alpha = 1 235 | 236 | sourceGridViewCell.highlighted = false 237 | let snapshotView = sourceGridViewCell.snapshotView() 238 | snapshotView.frame = sourceGridViewCell.bounds 239 | snapshotView.alpha = 0 240 | 241 | _beingMovedPromptView?.addSubview(snapshotView) 242 | _beingMovedPromptView?.addSubview(highlightedSnapshotView) 243 | collectionView?.addSubview(_beingMovedPromptView!) 244 | 245 | let kVibrateAnimation = "kVibrateAnimation" 246 | let VIBRATE_DURATION: CGFloat = 0.1 247 | let VIBRATE_RADIAN = CGFloat(M_PI/96) 248 | 249 | let vibrateAnimation = CABasicAnimation(keyPath: "transform.rotation.z") 250 | vibrateAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) 251 | vibrateAnimation.fromValue = -VIBRATE_RADIAN 252 | vibrateAnimation.toValue = VIBRATE_RADIAN 253 | vibrateAnimation.autoreverses = true 254 | vibrateAnimation.duration = CFTimeInterval(VIBRATE_DURATION) 255 | vibrateAnimation.repeatCount = Float(CGFloat.max) 256 | _beingMovedPromptView?.layer.addAnimation(vibrateAnimation, forKey: kVibrateAnimation) 257 | 258 | _sourceItemCollectionViewCellCenter = sourceGridViewCell.center 259 | 260 | UIView.animateWithDuration(0, delay: 0, options: .BeginFromCurrentState, animations: { () -> Void in 261 | 262 | highlightedSnapshotView.alpha = 0 263 | snapshotView.alpha = 1 264 | 265 | }, completion: { [unowned self] (finished) -> Void in 266 | 267 | highlightedSnapshotView.removeFromSuperview() 268 | 269 | self.delegate?.collectionView?(self.collectionView as! LxGridView, layout: self, didBeginDraggingItemAtIndexPath: self._movingItemIndexPath!) 270 | }) 271 | 272 | invalidateLayout() 273 | 274 | case .Ended: 275 | fallthrough 276 | case .Cancelled: 277 | _displayLink?.invalidate() 278 | _displayLink = nil 279 | 280 | if let movingItemIndexPath = _movingItemIndexPath { 281 | 282 | delegate?.collectionView?(collectionView as! LxGridView, layout: self, willEndDraggingItemAtIndexPath: movingItemIndexPath) 283 | 284 | _movingItemIndexPath = nil 285 | _sourceItemCollectionViewCellCenter = CGPointZero 286 | 287 | let movingItemCollectionViewLayoutAttributes = layoutAttributesForItemAtIndexPath(movingItemIndexPath) 288 | 289 | _longPressGestureRecognizer.enabled = false 290 | 291 | UIView.animateWithDuration(0, delay: 0, options: .BeginFromCurrentState, animations: { [unowned self] () -> Void in 292 | 293 | self._beingMovedPromptView!.center = movingItemCollectionViewLayoutAttributes.center 294 | }, completion: { [unowned self] (finished) -> Void in 295 | 296 | self._longPressGestureRecognizer.enabled = true 297 | self._beingMovedPromptView?.removeFromSuperview() 298 | self._beingMovedPromptView = nil 299 | self.invalidateLayout() 300 | self.delegate?.collectionView?(self.collectionView as! LxGridView, layout: self, didEndDraggingItemAtIndexPath: movingItemIndexPath) 301 | }) 302 | } 303 | default: 304 | break 305 | } 306 | } 307 | 308 | func panGestureRecognizerTriggerd(pan: UIPanGestureRecognizer) { 309 | 310 | switch pan.state { 311 | 312 | case .Began: 313 | fallthrough 314 | case .Changed: 315 | let panTranslation = pan.translationInView(collectionView!) 316 | _beingMovedPromptView?.center = _sourceItemCollectionViewCellCenter + panTranslation 317 | 318 | let sourceIndexPath = _movingItemIndexPath 319 | 320 | let destinationIndexPath = collectionView?.indexPathForItemAtPoint((_beingMovedPromptView?.center)!) 321 | 322 | if destinationIndexPath == nil || destinationIndexPath == sourceIndexPath { 323 | return 324 | } 325 | 326 | if dataSource?.collectionView?(collectionView as! LxGridView, itemAtIndexPath: sourceIndexPath!, canMoveToIndexPath: destinationIndexPath!) == false { 327 | return 328 | } 329 | 330 | dataSource?.collectionView?(collectionView as! LxGridView, itemAtIndexPath: sourceIndexPath!, willMoveToIndexPath: destinationIndexPath!) 331 | 332 | _movingItemIndexPath = destinationIndexPath 333 | collectionView?.performBatchUpdates({ [unowned self] () -> Void in 334 | self.collectionView?.deleteItemsAtIndexPaths([sourceIndexPath!]) 335 | self.collectionView?.insertItemsAtIndexPaths([destinationIndexPath!]) 336 | }, completion: { [unowned self] (finished) -> Void in 337 | 338 | self.dataSource?.collectionView?(collectionView as! LxGridView, itemAtIndexPath: sourceIndexPath!, didMoveToIndexPath: destinationIndexPath!) 339 | }) 340 | 341 | default: 342 | break 343 | } 344 | } 345 | 346 | func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool { 347 | 348 | if _panGestureRecognizer == gestureRecognizer && editing { 349 | 350 | return _movingItemIndexPath != nil 351 | } 352 | return true 353 | } 354 | 355 | func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool { 356 | 357 | if _longPressGestureRecognizer == gestureRecognizer { 358 | return _panGestureRecognizer == otherGestureRecognizer 359 | } 360 | if _panGestureRecognizer == gestureRecognizer { 361 | return _longPressGestureRecognizer == otherGestureRecognizer 362 | } 363 | return false 364 | } 365 | 366 | // MARK:- displayLink 367 | 368 | func displayLinkTriggered(displayLink: CADisplayLink) { 369 | 370 | if _remainSecondsToBeginEditing <= 0 { 371 | 372 | editing = true 373 | _displayLink?.invalidate() 374 | _displayLink = nil 375 | } 376 | 377 | _remainSecondsToBeginEditing = _remainSecondsToBeginEditing - 0.1 378 | } 379 | 380 | // MARK:- KVO and notification 381 | 382 | override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer) { 383 | 384 | if keyPath == "collectionView" { 385 | 386 | if collectionView != nil { 387 | 388 | addGestureRecognizers() 389 | } 390 | else { 391 | 392 | removeGestureRecognizers() 393 | } 394 | } 395 | } 396 | 397 | func applicationWillResignActive(notificaiton: NSNotification) { 398 | 399 | _panGestureRecognizer.enabled = false 400 | _panGestureRecognizer.enabled = true 401 | } 402 | } 403 | 404 | private func == (left: NSIndexPath, right: NSIndexPath) -> Bool { 405 | 406 | return left.section == right.section && left.item == right.item 407 | } 408 | 409 | func + (point: CGPoint, offset: CGPoint) -> CGPoint { 410 | 411 | return CGPoint(x: point.x + offset.x, y: point.y + offset.y) 412 | } 413 | -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B64623AC1B3EFF7B003A8FCA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64623AB1B3EFF7B003A8FCA /* AppDelegate.swift */; }; 11 | B64623AE1B3EFF7B003A8FCA /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B64623AD1B3EFF7B003A8FCA /* ViewController.swift */; }; 12 | B64623B11B3EFF7B003A8FCA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B64623AF1B3EFF7B003A8FCA /* Main.storyboard */; }; 13 | B64623B31B3EFF7B003A8FCA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B64623B21B3EFF7B003A8FCA /* Images.xcassets */; }; 14 | B64623B61B3EFF7B003A8FCA /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = B64623B41B3EFF7B003A8FCA /* LaunchScreen.xib */; }; 15 | B6BE3CF01B42F5570017B91C /* LxGridView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BE3CED1B42F5570017B91C /* LxGridView.swift */; }; 16 | B6BE3CF11B42F5570017B91C /* LxGridViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BE3CEE1B42F5570017B91C /* LxGridViewCell.swift */; }; 17 | B6BE3CF21B42F5570017B91C /* LxGridViewFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BE3CEF1B42F5570017B91C /* LxGridViewFlowLayout.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | B64623A61B3EFF7B003A8FCA /* LxGridViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LxGridViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | B64623AA1B3EFF7B003A8FCA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 23 | B64623AB1B3EFF7B003A8FCA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | B64623AD1B3EFF7B003A8FCA /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 25 | B64623B01B3EFF7B003A8FCA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 26 | B64623B21B3EFF7B003A8FCA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 27 | B64623B51B3EFF7B003A8FCA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 28 | B6BE3CED1B42F5570017B91C /* LxGridView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LxGridView.swift; sourceTree = ""; }; 29 | B6BE3CEE1B42F5570017B91C /* LxGridViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LxGridViewCell.swift; sourceTree = ""; }; 30 | B6BE3CEF1B42F5570017B91C /* LxGridViewFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LxGridViewFlowLayout.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | B64623A31B3EFF7B003A8FCA /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | B646239D1B3EFF7B003A8FCA = { 45 | isa = PBXGroup; 46 | children = ( 47 | B64623A81B3EFF7B003A8FCA /* LxGridViewDemo */, 48 | B64623A71B3EFF7B003A8FCA /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | B64623A71B3EFF7B003A8FCA /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | B64623A61B3EFF7B003A8FCA /* LxGridViewDemo.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | B64623A81B3EFF7B003A8FCA /* LxGridViewDemo */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | B6BE3CEC1B42F5570017B91C /* LxGridView */, 64 | B64623AB1B3EFF7B003A8FCA /* AppDelegate.swift */, 65 | B64623AD1B3EFF7B003A8FCA /* ViewController.swift */, 66 | B64623A91B3EFF7B003A8FCA /* Supporting Files */, 67 | ); 68 | path = LxGridViewDemo; 69 | sourceTree = ""; 70 | }; 71 | B64623A91B3EFF7B003A8FCA /* Supporting Files */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | B64623B41B3EFF7B003A8FCA /* LaunchScreen.xib */, 75 | B64623AF1B3EFF7B003A8FCA /* Main.storyboard */, 76 | B64623B21B3EFF7B003A8FCA /* Images.xcassets */, 77 | B64623AA1B3EFF7B003A8FCA /* Info.plist */, 78 | ); 79 | name = "Supporting Files"; 80 | sourceTree = ""; 81 | }; 82 | B6BE3CEC1B42F5570017B91C /* LxGridView */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | B6BE3CED1B42F5570017B91C /* LxGridView.swift */, 86 | B6BE3CEE1B42F5570017B91C /* LxGridViewCell.swift */, 87 | B6BE3CEF1B42F5570017B91C /* LxGridViewFlowLayout.swift */, 88 | ); 89 | name = LxGridView; 90 | path = ../../LxGridView; 91 | sourceTree = ""; 92 | }; 93 | /* End PBXGroup section */ 94 | 95 | /* Begin PBXNativeTarget section */ 96 | B64623A51B3EFF7B003A8FCA /* LxGridViewDemo */ = { 97 | isa = PBXNativeTarget; 98 | buildConfigurationList = B64623C51B3EFF7B003A8FCA /* Build configuration list for PBXNativeTarget "LxGridViewDemo" */; 99 | buildPhases = ( 100 | B64623A21B3EFF7B003A8FCA /* Sources */, 101 | B64623A31B3EFF7B003A8FCA /* Frameworks */, 102 | B64623A41B3EFF7B003A8FCA /* Resources */, 103 | ); 104 | buildRules = ( 105 | ); 106 | dependencies = ( 107 | ); 108 | name = LxGridViewDemo; 109 | productName = LxGridViewDemo; 110 | productReference = B64623A61B3EFF7B003A8FCA /* LxGridViewDemo.app */; 111 | productType = "com.apple.product-type.application"; 112 | }; 113 | /* End PBXNativeTarget section */ 114 | 115 | /* Begin PBXProject section */ 116 | B646239E1B3EFF7B003A8FCA /* Project object */ = { 117 | isa = PBXProject; 118 | attributes = { 119 | LastUpgradeCheck = 0630; 120 | ORGANIZATIONNAME = DeveloperLx; 121 | TargetAttributes = { 122 | B64623A51B3EFF7B003A8FCA = { 123 | CreatedOnToolsVersion = 6.3; 124 | }; 125 | }; 126 | }; 127 | buildConfigurationList = B64623A11B3EFF7B003A8FCA /* Build configuration list for PBXProject "LxGridViewDemo" */; 128 | compatibilityVersion = "Xcode 3.2"; 129 | developmentRegion = English; 130 | hasScannedForEncodings = 0; 131 | knownRegions = ( 132 | en, 133 | Base, 134 | ); 135 | mainGroup = B646239D1B3EFF7B003A8FCA; 136 | productRefGroup = B64623A71B3EFF7B003A8FCA /* Products */; 137 | projectDirPath = ""; 138 | projectRoot = ""; 139 | targets = ( 140 | B64623A51B3EFF7B003A8FCA /* LxGridViewDemo */, 141 | ); 142 | }; 143 | /* End PBXProject section */ 144 | 145 | /* Begin PBXResourcesBuildPhase section */ 146 | B64623A41B3EFF7B003A8FCA /* Resources */ = { 147 | isa = PBXResourcesBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | B64623B11B3EFF7B003A8FCA /* Main.storyboard in Resources */, 151 | B64623B61B3EFF7B003A8FCA /* LaunchScreen.xib in Resources */, 152 | B64623B31B3EFF7B003A8FCA /* Images.xcassets in Resources */, 153 | ); 154 | runOnlyForDeploymentPostprocessing = 0; 155 | }; 156 | /* End PBXResourcesBuildPhase section */ 157 | 158 | /* Begin PBXSourcesBuildPhase section */ 159 | B64623A21B3EFF7B003A8FCA /* Sources */ = { 160 | isa = PBXSourcesBuildPhase; 161 | buildActionMask = 2147483647; 162 | files = ( 163 | B6BE3CF11B42F5570017B91C /* LxGridViewCell.swift in Sources */, 164 | B6BE3CF01B42F5570017B91C /* LxGridView.swift in Sources */, 165 | B64623AE1B3EFF7B003A8FCA /* ViewController.swift in Sources */, 166 | B64623AC1B3EFF7B003A8FCA /* AppDelegate.swift in Sources */, 167 | B6BE3CF21B42F5570017B91C /* LxGridViewFlowLayout.swift in Sources */, 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | }; 171 | /* End PBXSourcesBuildPhase section */ 172 | 173 | /* Begin PBXVariantGroup section */ 174 | B64623AF1B3EFF7B003A8FCA /* Main.storyboard */ = { 175 | isa = PBXVariantGroup; 176 | children = ( 177 | B64623B01B3EFF7B003A8FCA /* Base */, 178 | ); 179 | name = Main.storyboard; 180 | sourceTree = ""; 181 | }; 182 | B64623B41B3EFF7B003A8FCA /* LaunchScreen.xib */ = { 183 | isa = PBXVariantGroup; 184 | children = ( 185 | B64623B51B3EFF7B003A8FCA /* Base */, 186 | ); 187 | name = LaunchScreen.xib; 188 | sourceTree = ""; 189 | }; 190 | /* End PBXVariantGroup section */ 191 | 192 | /* Begin XCBuildConfiguration section */ 193 | B64623C31B3EFF7B003A8FCA /* Debug */ = { 194 | isa = XCBuildConfiguration; 195 | buildSettings = { 196 | ALWAYS_SEARCH_USER_PATHS = NO; 197 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 198 | CLANG_CXX_LIBRARY = "libc++"; 199 | CLANG_ENABLE_MODULES = YES; 200 | CLANG_ENABLE_OBJC_ARC = YES; 201 | CLANG_WARN_BOOL_CONVERSION = YES; 202 | CLANG_WARN_CONSTANT_CONVERSION = YES; 203 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 204 | CLANG_WARN_EMPTY_BODY = YES; 205 | CLANG_WARN_ENUM_CONVERSION = YES; 206 | CLANG_WARN_INT_CONVERSION = YES; 207 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 208 | CLANG_WARN_UNREACHABLE_CODE = YES; 209 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 210 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 211 | COPY_PHASE_STRIP = NO; 212 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 213 | ENABLE_STRICT_OBJC_MSGSEND = YES; 214 | GCC_C_LANGUAGE_STANDARD = gnu99; 215 | GCC_DYNAMIC_NO_PIC = NO; 216 | GCC_NO_COMMON_BLOCKS = YES; 217 | GCC_OPTIMIZATION_LEVEL = 0; 218 | GCC_PREPROCESSOR_DEFINITIONS = ( 219 | "DEBUG=1", 220 | "$(inherited)", 221 | ); 222 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 223 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 224 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 225 | GCC_WARN_UNDECLARED_SELECTOR = YES; 226 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 227 | GCC_WARN_UNUSED_FUNCTION = YES; 228 | GCC_WARN_UNUSED_VARIABLE = YES; 229 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 230 | MTL_ENABLE_DEBUG_INFO = YES; 231 | ONLY_ACTIVE_ARCH = YES; 232 | SDKROOT = iphoneos; 233 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 234 | TARGETED_DEVICE_FAMILY = "1,2"; 235 | }; 236 | name = Debug; 237 | }; 238 | B64623C41B3EFF7B003A8FCA /* Release */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 243 | CLANG_CXX_LIBRARY = "libc++"; 244 | CLANG_ENABLE_MODULES = YES; 245 | CLANG_ENABLE_OBJC_ARC = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INT_CONVERSION = YES; 252 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 253 | CLANG_WARN_UNREACHABLE_CODE = YES; 254 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 255 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 256 | COPY_PHASE_STRIP = NO; 257 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 258 | ENABLE_NS_ASSERTIONS = NO; 259 | ENABLE_STRICT_OBJC_MSGSEND = YES; 260 | GCC_C_LANGUAGE_STANDARD = gnu99; 261 | GCC_NO_COMMON_BLOCKS = YES; 262 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 263 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 264 | GCC_WARN_UNDECLARED_SELECTOR = YES; 265 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 266 | GCC_WARN_UNUSED_FUNCTION = YES; 267 | GCC_WARN_UNUSED_VARIABLE = YES; 268 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 269 | MTL_ENABLE_DEBUG_INFO = NO; 270 | SDKROOT = iphoneos; 271 | TARGETED_DEVICE_FAMILY = "1,2"; 272 | VALIDATE_PRODUCT = YES; 273 | }; 274 | name = Release; 275 | }; 276 | B64623C61B3EFF7B003A8FCA /* Debug */ = { 277 | isa = XCBuildConfiguration; 278 | buildSettings = { 279 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 280 | INFOPLIST_FILE = LxGridViewDemo/Info.plist; 281 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 282 | PRODUCT_NAME = "$(TARGET_NAME)"; 283 | }; 284 | name = Debug; 285 | }; 286 | B64623C71B3EFF7B003A8FCA /* Release */ = { 287 | isa = XCBuildConfiguration; 288 | buildSettings = { 289 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 290 | INFOPLIST_FILE = LxGridViewDemo/Info.plist; 291 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 292 | PRODUCT_NAME = "$(TARGET_NAME)"; 293 | }; 294 | name = Release; 295 | }; 296 | /* End XCBuildConfiguration section */ 297 | 298 | /* Begin XCConfigurationList section */ 299 | B64623A11B3EFF7B003A8FCA /* Build configuration list for PBXProject "LxGridViewDemo" */ = { 300 | isa = XCConfigurationList; 301 | buildConfigurations = ( 302 | B64623C31B3EFF7B003A8FCA /* Debug */, 303 | B64623C41B3EFF7B003A8FCA /* Release */, 304 | ); 305 | defaultConfigurationIsVisible = 0; 306 | defaultConfigurationName = Release; 307 | }; 308 | B64623C51B3EFF7B003A8FCA /* Build configuration list for PBXNativeTarget "LxGridViewDemo" */ = { 309 | isa = XCConfigurationList; 310 | buildConfigurations = ( 311 | B64623C61B3EFF7B003A8FCA /* Debug */, 312 | B64623C71B3EFF7B003A8FCA /* Release */, 313 | ); 314 | defaultConfigurationIsVisible = 0; 315 | defaultConfigurationName = Release; 316 | }; 317 | /* End XCConfigurationList section */ 318 | }; 319 | rootObject = B646239E1B3EFF7B003A8FCA /* Project object */; 320 | } 321 | -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // LxGridViewDemo 4 | // 5 | 6 | import UIKit 7 | 8 | @UIApplicationMain 9 | class AppDelegate: UIResponder, UIApplicationDelegate { 10 | 11 | var window: UIWindow? 12 | 13 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 14 | 15 | return true 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/0.imageset/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/0.imageset/0.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/0.imageset/0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/0.imageset/0@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "0.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "0@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/1.imageset/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/1.imageset/1.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/1.imageset/1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/1.imageset/1@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "1.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "1@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/10.imageset/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/10.imageset/10.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/10.imageset/10@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/10.imageset/10@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/10.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "10.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "10@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/11.imageset/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/11.imageset/11.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/11.imageset/11@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/11.imageset/11@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/11.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "11.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "11@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/12.imageset/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/12.imageset/12.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/12.imageset/12@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/12.imageset/12@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/12.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "12.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "12@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/13.imageset/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/13.imageset/13.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/13.imageset/13@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/13.imageset/13@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/13.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "13.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "13@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/14.imageset/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/14.imageset/14.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/14.imageset/14@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/14.imageset/14@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/14.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "14.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "14@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/15.imageset/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/15.imageset/15.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/15.imageset/15@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/15.imageset/15@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/15.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "15.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "15@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/16.imageset/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/16.imageset/16.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/16.imageset/16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/16.imageset/16@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/16.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "16.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "16@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/17.imageset/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/17.imageset/17.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/17.imageset/17@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/17.imageset/17@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/17.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "17.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "17@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/18.imageset/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/18.imageset/18.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/18.imageset/18@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/18.imageset/18@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/18.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "18.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "18@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/19.imageset/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/19.imageset/19.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/19.imageset/19@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/19.imageset/19@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/19.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "19.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "19@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/2.imageset/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/2.imageset/2.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/2.imageset/2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/2.imageset/2@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "2.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "2@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/20.imageset/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/20.imageset/20.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/20.imageset/20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/20.imageset/20@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/20.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "20.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "20@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/21.imageset/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/21.imageset/21.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/21.imageset/21@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/21.imageset/21@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/21.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "21.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "21@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/22.imageset/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/22.imageset/22.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/22.imageset/22@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/22.imageset/22@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/22.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "22.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "22@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/23.imageset/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/23.imageset/23.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/23.imageset/23@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/23.imageset/23@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/23.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "23.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "23@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/24.imageset/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/24.imageset/24.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/24.imageset/24@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/24.imageset/24@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/24.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "24.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "24@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/25.imageset/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/25.imageset/25.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/25.imageset/25@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/25.imageset/25@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/25.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "25.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "25@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/26.imageset/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/26.imageset/26.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/26.imageset/26@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/26.imageset/26@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/26.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "26.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "26@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/27.imageset/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/27.imageset/27.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/27.imageset/27@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/27.imageset/27@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/27.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "27.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "27@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/28.imageset/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/28.imageset/28.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/28.imageset/28@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/28.imageset/28@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/28.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "28.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "28@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/29.imageset/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/29.imageset/29.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/29.imageset/29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/29.imageset/29@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/29.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "29.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "29@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/3.imageset/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/3.imageset/3.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/3.imageset/3@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/3.imageset/3@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "3.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "3@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/30.imageset/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/30.imageset/30.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/30.imageset/30@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/30.imageset/30@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/30.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "30.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "30@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/4.imageset/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/4.imageset/4.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/4.imageset/4@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/4.imageset/4@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "4.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "4@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/5.imageset/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/5.imageset/5.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/5.imageset/5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/5.imageset/5@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "5.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "5@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/6.imageset/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/6.imageset/6.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/6.imageset/6@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/6.imageset/6@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/6.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "6.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "6@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/7.imageset/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/7.imageset/7.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/7.imageset/7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/7.imageset/7@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/7.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "7.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "7@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/8.imageset/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/8.imageset/8.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/8.imageset/8@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/8.imageset/8@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/8.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "8.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "8@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/9.imageset/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/9.imageset/9.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/9.imageset/9@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/9.imageset/9@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/9.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "9.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "9@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/AppIcon-1.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "60x60", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "29x29", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "40x40", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "76x76", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "extent" : "full-screen", 14 | "minimum-system-version" : "7.0", 15 | "subtype" : "retina4", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/delete_collect_btn.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "delete_collect_btn.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "delete_collect_btn@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/delete_collect_btn.imageset/delete_collect_btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/delete_collect_btn.imageset/delete_collect_btn.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Images.xcassets/delete_collect_btn.imageset/delete_collect_btn@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/LxGridViewDemo/LxGridViewDemo/Images.xcassets/delete_collect_btn.imageset/delete_collect_btn@2x.png -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | etiantian.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LxGridViewDemo/LxGridViewDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // LxGridViewDemo 4 | // 5 | 6 | import UIKit 7 | 8 | let LxGridViewCellReuseIdentifier = "LxGridViewCellReuseIdentifier" 9 | let HOME_BUTTON_RADIUS: CGFloat = 21 10 | let HOME_BUTTON_BOTTOM_MARGIN: CGFloat = 9 11 | 12 | class ViewController: UIViewController, LxGridViewDataSource, LxGridViewDelegateFlowLayout, LxGridViewCellDelegate { 13 | 14 | var dataArray = [[String:AnyObject?]]() 15 | 16 | var _gridView: LxGridView? 17 | let _gridViewFlowLayout = LxGridViewFlowLayout() 18 | let _homeButton = UIButton.buttonWithType(.Custom) as! UIButton 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | 23 | edgesForExtendedLayout = .None 24 | 25 | for i in 0..<15 { 26 | 27 | var dataDict = [String:AnyObject?]() 28 | dataDict["index"] = "App \(i)" 29 | dataDict["icon_image"] = UIImage(named: "\(i)") 30 | dataArray.append(dataDict) 31 | } 32 | 33 | _gridViewFlowLayout.sectionInset = UIEdgeInsets(top: 18, left: 30, bottom: 18, right: 30) 34 | _gridViewFlowLayout.minimumLineSpacing = 9 35 | _gridViewFlowLayout.itemSize = CGSize(width: 66, height: 88) 36 | 37 | _gridView = LxGridView(frame: CGRectZero, collectionViewLayout: _gridViewFlowLayout) 38 | _gridView?.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0) 39 | _gridView?.delegate = self 40 | _gridView?.dataSource = self 41 | _gridView?.scrollEnabled = false 42 | _gridView?.backgroundColor = UIColor.whiteColor() 43 | view.addSubview(_gridView!) 44 | 45 | _gridView?.registerClass(LxGridViewCell.classForCoder(), forCellWithReuseIdentifier: LxGridViewCellReuseIdentifier) 46 | 47 | _homeButton.showsTouchWhenHighlighted = true 48 | _homeButton.layer.cornerRadius = HOME_BUTTON_RADIUS 49 | _homeButton.layer.masksToBounds = true 50 | _homeButton.layer.borderWidth = 1 51 | _homeButton.layer.borderColor = UIColor.blackColor().CGColor 52 | _homeButton.titleLabel?.font = UIFont.systemFontOfSize(15) 53 | _homeButton.setTitle("☐", forState: .Normal) 54 | _homeButton.setTitleColor(UIColor.blackColor(), forState: .Normal) 55 | _homeButton.addTarget(self, action: Selector("homeButtonClicked:"), forControlEvents: .TouchUpInside) 56 | view.addSubview(_homeButton) 57 | 58 | _gridView?.setTranslatesAutoresizingMaskIntoConstraints(false) 59 | 60 | let gridViewTopMargin = NSLayoutConstraint(item: _gridView!, attribute: .Top, relatedBy: .Equal, toItem: view, attribute: .Top, multiplier: 1, constant: 0) 61 | let gridViewRightMargin = NSLayoutConstraint(item: _gridView!, attribute: .Right, relatedBy: .Equal, toItem: view, attribute: .Right, multiplier: 1, constant: 0) 62 | let gridViewBottomMargin = NSLayoutConstraint(item: _gridView!, attribute: .Bottom, relatedBy: .Equal, toItem: view, attribute: .Bottom, multiplier: 1, constant: 0) 63 | let gridViewLeftMargin = NSLayoutConstraint(item: _gridView!, attribute: .Left, relatedBy: .Equal, toItem: view, attribute: .Left, multiplier: 1, constant: 0) 64 | view.addConstraints([gridViewTopMargin, gridViewRightMargin, gridViewBottomMargin, gridViewLeftMargin]) 65 | 66 | _homeButton.setTranslatesAutoresizingMaskIntoConstraints(false) 67 | 68 | let centerXConstraint = NSLayoutConstraint(item: _homeButton, attribute: .CenterX, relatedBy: .Equal, toItem: view, attribute: .CenterX, multiplier: 1, constant: 0) 69 | let homeButtonBottomMargin = NSLayoutConstraint(item: _homeButton, attribute: .Bottom, relatedBy: .Equal, toItem: view, attribute: .Bottom, multiplier: 1, constant: -HOME_BUTTON_BOTTOM_MARGIN) 70 | let homeButtonWidthMargin = NSLayoutConstraint(item: _homeButton, attribute: .Width, relatedBy: .Equal, toItem: nil, attribute: .Width, multiplier: 1, constant: HOME_BUTTON_RADIUS * 2) 71 | let homeButtonHeightMargin = NSLayoutConstraint(item: _homeButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .Height, multiplier: 1, constant: HOME_BUTTON_RADIUS * 2) 72 | view.addConstraints([centerXConstraint, homeButtonBottomMargin, homeButtonWidthMargin, homeButtonHeightMargin]) 73 | } 74 | 75 | func homeButtonClicked(btn: UIButton) { 76 | 77 | _gridView?.editing = false 78 | } 79 | 80 | // MARK:- delegate 81 | 82 | func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 83 | 84 | return dataArray.count 85 | } 86 | 87 | func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 88 | 89 | let cell = collectionView.dequeueReusableCellWithReuseIdentifier(LxGridViewCellReuseIdentifier, forIndexPath: indexPath) as! LxGridViewCell 90 | 91 | cell.delegate = self 92 | cell.editing = _gridView!.editing 93 | 94 | let dataDict = dataArray[indexPath.item] as [String:AnyObject?] 95 | cell.title = dataDict["index"] as? String 96 | cell.iconImageView?.image = dataDict["icon_image"] as? UIImage 97 | 98 | return cell 99 | } 100 | 101 | func collectionView(collectionView: LxGridView, itemAtIndexPath sourceIndexPath: NSIndexPath, willMoveToIndexPath destinationIndexPath: NSIndexPath) { 102 | 103 | let dataDict = dataArray[sourceIndexPath.item] 104 | dataArray.removeAtIndex(sourceIndexPath.item) 105 | dataArray.insert(dataDict, atIndex: destinationIndexPath.item) 106 | } 107 | 108 | func deleteButtonClickedInGridViewCell(gridViewCell: LxGridViewCell) { 109 | 110 | if let gridViewCellIndexPath = _gridView!.indexPathForCell(gridViewCell) { 111 | 112 | dataArray.removeAtIndex(gridViewCellIndexPath.item) 113 | _gridView?.performBatchUpdates({ [unowned self] () -> Void in 114 | self._gridView?.deleteItemsAtIndexPaths([gridViewCellIndexPath]) 115 | }, completion: nil) 116 | } 117 | } 118 | } 119 | 120 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LxGridView-swift 2 | Imitate Apple iOS system Desktop icons arrangement and interaction by inheriting UICollectionView! 3 | 4 | * ![demo](demo.gif) 5 | --- 6 | ### Installation 7 | You only need drag directory LxGridView to your project. 8 | ### Support 9 | Minimum support iOS version: iOS 6.0 10 | ### Usage 11 | 12 | `You can use LxGridView as convenient as UICollectionView.` 13 | 14 | let _gridViewFlowLayout = LxGridViewFlowLayout() 15 | // ... config _gridViewFlowLayout 16 | 17 | _gridView = LxGridView(frame: GRIDVIEW_FRAME, collectionViewLayout: _gridViewFlowLayout) 18 | // ... congif _gridView 19 | 20 | _gridView.registerClass(LxGridViewCell.classForCoder(), forCellWithReuseIdentifier: GRIDVIEW_CELL_REUSE_IDENTIFIER) 21 | 22 | // implement delegate method 23 | func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 24 | 25 | return dataArray.count 26 | } 27 | 28 | func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { 29 | 30 | let cell = collectionView.dequeueReusableCellWithReuseIdentifier(LxGridViewCellReuseIdentifier, forIndexPath: indexPath) as! LxGridViewCell 31 | 32 | cell.delegate = self 33 | cell.editing = _gridView.editing 34 | 35 | // ... config cell 36 | 37 | return cell 38 | } 39 | 40 | func collectionView(collectionView: LxGridView, itemAtIndexPath sourceIndexPath: NSIndexPath, willMoveToIndexPath destinationIndexPath: NSIndexPath) { 41 | 42 | let dataDict = dataArray[sourceIndexPath.item] 43 | dataArray.removeAtIndex(sourceIndexPath.item) 44 | dataArray.insert(dataDict, atIndex: destinationIndexPath.item) 45 | } 46 | 47 | func deleteButtonClickedInGridViewCell(gridViewCell: LxGridViewCell) { 48 | 49 | if let gridViewCellIndexPath = _gridView!.indexPathForCell(gridViewCell) { 50 | 51 | dataArray.removeAtIndex(gridViewCellIndexPath.item) 52 | _gridView.performBatchUpdates({ [unowned self] () -> Void in 53 | self._gridView.deleteItemsAtIndexPaths([gridViewCellIndexPath]) 54 | }, completion: nil) 55 | } 56 | } 57 | 58 | --- 59 | ### License 60 | LxGridView is available under the Apache License 2.0. See the LICENSE file for more info. -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DeveloperLx/LxGridView-swift/b975e7a49290fe11bcead8c3c55a1bbe06087569/demo.gif --------------------------------------------------------------------------------