文章来源:淘论文网   发布者: 毕业设计   浏览量: 23

定做请加QQ:1052602713 或加微信:


还可以点击去查询以下关键词:
[Swift]    [定制]    [ASCollectionView]    [【Swift】定制ASCollectionView]   

项目介绍:

ASCollectionView

https://github.com/abdullahselek/ASCollectionView

使用Swift collectionView模仿Airbnb的布局。

Screenshots

Requirements 环境需求

iOS 8.0+

CocoaPods 通过 cocopods导入

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods For Swift 3You can use 1.0.3For Swift 2.3Please use 1.0.2

To integrate ASCollectionView into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! target '<Your Target Name>' do pod 'ASCollectionView', '1.0.1' end

Then, run the following command:

$ pod install Carthage 通过 Carthage 进行集成

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

Carthage是一个依赖管理器,它构建了你的依赖并为你提供了框架。
您可以使用以下命令使用Homebrew安装Carthage

brew update brew install carthage

To integrate ASCollectionView into your Xcode project using Carthage, specify it in your Cartfile:
要使用Carthage将ASCollectionView集成到您的Xcode项目中,开题报告,请在Cartfile中写下以下代码:

github 'abdullahselek/ASCollectionView' ~> 1.0.4

Run carthage update to build the framework and drag the built ASCollectionView.framework into your Xcode project.
执行命令 carthage update 来构建框架并将 ASCollectionView.framework拖动到你的Xcode项目中。

Example Usage

There is a sample viewcontroller inside demo folder and I added some sample code below.

You can add collectionview to your storyboard, xib file or add programmatically and then set constraints. Turn back to your
viewcontroller and implement custom datasource and delegate methods.

在demo文件夹中有一个示例viewcontroller,开题报告,我在下面添加了一些示例代码。
您可以向storyboard,xib文件添加collectionview或以代码形式添加,然后设置约束。 回到你的
viewcontroller并实现自定义数据源和委托方法。

class ViewController: UIViewController, ASCollectionViewDataSource, ASCollectionViewDelegate { ... override func viewDidLoad() { super.viewDidLoad() collectionView.registerNib(UINib(nibName: collectionElementKindHeader, bundle: nil), forSupplementaryViewOfKind: collectionElementKindHeader, withReuseIdentifier: 'header') collectionView.delegate = self collectionView.asDataSource = self } // MARK: ASCollectionViewDataSource func numberOfItemsInASCollectionView(asCollectionView: ASCollectionView) -> Int { return numberOfItems } func collectionView(asCollectionView: ASCollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let gridCell = collectionView.dequeueReusableCellWithReuseIdentifier('cell', forIndexPath: indexPath) as! GridCell gridCell.label.text = NSString(format: 'Item %ld ', indexPath.row) as String gridCell.imageView.image = UIImage(named: NSString(format: 'image-%ld', indexPath.row % 10) as String) return gridCell } func collectionView(asCollectionView: ASCollectionView, parallaxCellForItemAtIndexPath indexPath: NSIndexPath) -> ASCollectionViewParallaxCell { let parallaxCell = collectionView.dequeueReusableCellWithReuseIdentifier('parallaxCell', forIndexPath: indexPath) as! ParallaxCell parallaxCell.label.text = NSString(format: 'Item %ld ', indexPath.row) as String parallaxCell.updateParallaxImage(UIImage(named: NSString(format: 'image-%ld', indexPath.row % 10) as String)!) return parallaxCell } func collectionView(asCollectionView: ASCollectionView, headerAtIndexPath indexPath: NSIndexPath) -> UICollectionReusableView { let header = collectionView.dequeueReusableSupplementaryViewOfKind(ASCollectionViewElement.Header, withReuseIdentifier: 'header', forIndexPath: indexPath) return header } func loadMoreInASCollectionView(asCollectionView: ASCollectionView) { if numberOfItems > 30 { collectionView.enableLoadMore = false return } numberOfItems += 10 collectionView.loadingMore = false collectionView.reloadData() } GridCell collectionview cell used in sample class GridCell: UICollectionViewCell { @IBOutlet var label: UILabel! @IBOutlet var imageView: UIImageView! } ParallaxCell used in sample class ParallaxCell: ASCollectionViewParallaxCell { @IBOutlet var label: UILabel! } ![code4app]()


这里还有:


还可以点击去查询:
[Swift]    [定制]    [ASCollectionView]    [【Swift】定制ASCollectionView]   

请扫码加微信 微信号:sj52abcd


下载地址: http://www.taolw.com/down/8432.docx
  • 上一篇:【Swift】毕业设计CalendarPopUp
  • 下一篇:【Swift】Ca毕业设计rdStackController