RHPreviewCell

我很羡慕 Spotify iOS 应用程序这个很棒的播放列表预览单元,我决定创建我自己的一个。现在你可以让你的用户快速检查“什么内容隐藏在你的 UITableViewCell”。很棒的想法是,这个库不需要用户 deviceboom 的 3D 触摸支持!「I envied so much Spotify iOS app this great playlist preview cell, I decided to create my own one. Now you can give your users ability to quick check "what content is hidden under your UITableViewCell". Great think is that this Library not requires 3D Touch support from user device」

Github星跟蹤圖

Version
License
Platform
Language
Twitter

RHPreviewCell 🌶

I envied so much Spotify iOS app this great playlist preview cell 😍, I decided to create my own one 🌶. Now you can give your users ability to quick check "what content is hidden under your UITableViewCell". Great think is that this Library not requires 3D Touch support from user device💥.

Play with it 😎

Installation

You can install RHPreviewCell library using Cocoapods:

pod 'RHPreviewCell'

or you can simply copy RHPreviewCellSource folder to your project.

Usage

To fully integrate RHPreviewCell with your Table View you just need to use RHPreviewCell like normal UITableViewCell in terms of your TableView data source 'cellForRowAtIndexPath' method.

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    // Fetching already registered RHPreviewTableViewCell
    let cell = tableView.dequeueReusableCellWithIdentifier(reuseCellIdentifier) as! RHPreviewTableViewCell

    // Delegate using which, tiles will talk to your class
    cell.delegate = self
    // Data source for feed small tiles 🚼
    cell.dataSource = self

    return cell
}

💡 Important thing is that your View Controller needs to comform to RHPreviewCellDataSource and RHPreviewCellDelegate protocols. In that way you will be able to provide all neccesary data for RHPreviewTalveViewCell tiles.

RHPreviewCellDataSource

func previewCellNumberOfTiles(cell: RHPreviewTableViewCell) -> Int
func previewCell(cell: RHPreviewTableViewCell, tileForIndex: Int) -> RHPreviewTileView

RHPreviewCellDelegate

func previewCell(cell: RHPreviewTableViewCell, didSelectTileAtIndex indexValue: RHTappedTileIndexValue)

And thats it! 💥 You have already integrete Library with your Table View 🎉

Implementation hint from me

[Q] How may look like tiles communiacation with my class❓🤔

As I said using RHPreviewCellDelegate . I will show you how to handle it for particular cell:

func previewCell(cell: RHPreviewTableViewCell, didSelectTileAtIndex indexValue: RHTappedTileIndexValue) {
    let cellIndex = tableView.indexPathForCell(cell)!.row

    switch indexValue {
    case .TileTapped(let index):
        print("😲 \(index) has been selected")
    case .FingerReleased:
        print("🖖🏽 Finger has been released (non of tiles has been tapped)")
    }
}

... as you can see delegate method as a argument takes RHTappedTileIndexValue , yup... it is swift enum using which you will gather information about tapped tile (.TileTapped(let index) ) or even whether user released his finger out of tiles area (.FingerReleased ).

Swift support

Library ver Swift ver
1.0.1 2.2
1.0.2 2.3
1.0.3 3.0
1.1.0 4.0

Check the Demo project

Please check out the demo project, you can see there how Library has been implemented in details.

主要指標

概覽
名稱與所有者robertherdzik/RHPreviewCell
主編程語言Swift
編程語言Swift (語言數: 3)
平台iOS, Mac
許可證MIT License
所有者活动
創建於2016-09-25 18:15:57
推送於2018-05-24 06:28:19
最后一次提交2018-05-24 08:28:18
發布數5
最新版本名稱1.1.0 (發布於 )
第一版名稱1.0.0 (發布於 )
用户参与
星數386
關注者數7
派生數16
提交數49
已啟用問題?
問題數3
打開的問題數1
拉請求數11
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?