Git Product home page Git Product logo

tinderuisamples's Introduction

TinderUISamples

[ING] - TinderのようなUIを様々な実装で実現してみるサンプル

今回はTinder風のUIを自前で用意する際の実装ポイントや気をつけるべき点等を知りたいと感じたので、同様な形ではあるが内部実装は全く異なるTinder風UIサンプルを2種類を用意しました。

本サンプルの画面キャプチャ

sample_summary.jpg

実装例1. UIView + UIPanGestureRecognizerを利用したUI実装

動かすカードのView側にProtocolをあらかじめ定義しておき、UIViewControllerを連携してGestureRecognizer発動時のタイミングで行われる処理(左右への動きやスワイプ後などの処理)を実行するような形の実装になっています。

画面デザインのラフスケッチ:

example1_design.jpg

クラスの関係図&解説メモ:

example1_memo.jpg

実装例2. UICollectionView + UILongPressGestureRecognizerを利用したUI実装

UICollectionViewLayoutクラスを継承したクラスを利用してカード表示画面の設定を行い、GestureRecognizer発動時のタイミングで行われる処理と組み合わせる形の実装になっています。

UILongPressGestureRecognizer経由で対象のセルを選び出した後は、stateプロパティの状態を元にそれぞれの処理を記載していく形になります。 このサンプルで実際に動いているのは、選び出したUICollectionViewCellではなく、 「UICollectionViewCellのスナップショットを表示したUIImageView」 になります。

画面デザインのラフスケッチ:

example2_design.jpg

クラスの関係図&解説メモ:

example2_memo.jpg

その他

このサンプル全体の詳細解説とポイントをまとめたものは下記に掲載しております。

tinderuisamples's People

Contributors

fumiyasac avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.