RHPreviewCell:遵从简洁交互设计,通过遮罩层快速预览单元格内容 1

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:遵从简洁交互设计,通过遮罩层快速预览单元格内容 1





1、RHPreviewCell

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 12

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 12


I envied so much Spotify iOS app this great playlist preview cell

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 1

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 1
, I decided to create my own one

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 2

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 2
. 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

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 3

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 3
.




2、Play with it

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 13

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 13


RHPreviewCell:遵从简洁交互设计,通过遮罩层快速预览单元格内容 2

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:遵从简洁交互设计,通过遮罩层快速预览单元格内容 2





3、Installation

You can install RHPreviewCell library using Cocoapods:

[Bash shell] 纯文本查看 复制代码
pod 'RHPreviewCell'


or you can simply copy RHPreviewCellSource folder to your project.




4、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.

[Swift] 纯文本查看 复制代码
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 [attach]36867[/attach]
    cell.dataSource = self

    return cell
}


RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 5

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 5
Important think 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.



4.1、RHPreviewCellDataSource

[Swift] 纯文本查看 复制代码
func previewCellNumberOfTiles(cell: RHPreviewTableViewCell) -> Int
func previewCell(cell: RHPreviewTableViewCell, tileForIndex: Int) -> RHPreviewTileView




4.2、RHPreviewCellDelegate

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

And thats it!

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 6

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 6
You have already integrete Library with your Table View

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 7

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 7


RHPreviewCell:遵从简洁交互设计,通过遮罩层快速预览单元格内容 3

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:遵从简洁交互设计,通过遮罩层快速预览单元格内容 3





5、Implementation hint from me

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

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 8

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 8

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 9

RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 - 敏捷大拇指 - RHPreviewCell:简洁交互设计,通过遮罩层快速预览单元格内容 9


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

[Swift] 纯文本查看 复制代码
func previewCell(cell: RHPreviewTableViewCell, didSelectTileAtIndex indexValue: RHTappedTileIndexValue) {
    let cellIndex = tableView.indexPathForCell(cell)!.row

    switch indexValue {
    case .TileTapped(let index):
        print("[attach]36861[/attach] \(index) has been selected")
    case .FingerReleased:
        print("[attach]36860[/attach] 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 ).




6、Swift support

Library ver
Swift ver
1.0.0
2.3





7、Check the Demo project

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

GitHub地址:
游客,如果您要查看本帖隐藏内容请回复