?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

TinderSimpleSwipeCards

SwipeCards1.gif

This is for maximum customizability and / or learning purposes, not a pod or drop-in solution

The basics of a Tinder-like swipeable cards interface influenced by http://guti.in/articles/creating-tinder-like-animations/

This is meant to be taken and built off of, not as a simple drag and drop solution. New developers are often forced to use dependencies they don't understand and can't customize. This is the opposite. I've fully explained exactly how this works in detailed comments so that you can take it apart and customize it at will. For a pod/drag and drop solution, seehttps://github.com/modocache/MDCSwipeToChoose

Updates, Questions, and Requests

twitter <--- I am a very light twitterer, so I wont spam you

Relevant Article for deciding how to implement swipe cards into your app

https://medium.com/@cwRichardKim/adding-tinder-esque-cards-to-your-iphone-app-4047967303d1

On top of your current View Controllers

SwipeCards2.gif

Features:

  • Swipe cards left or right to call two separate actions
  • Have multiple cards on screen depending on the number of items in an array
  • Extremely simple, every component is explained
  • Very easily customizeable

Customizeability Examples:

action margin (the distance from the middle required for an action to take place)

SwipeCards3.gifSwipeCards4.gif

squeeze ratio (limit, strength)

SwipeCards5.gif

SwipeCards6.gif

rotation (strength, limit, angle)

SwipeCards7.gifSwipeCards8.gif

+ More!

in DraggableView.h

  • ACTION_MARGIN: distance from center where the action applies. Higher = swipe further in order for the action to be called
  • SCALE_STRENGTH: how quickly the card shrinks. Higher = slower shrinking
  • SCALE_MAX: upper bar for how much the card shrinks. Higher = shrinks less
  • ROTATION_MAX: the maximum rotation allowed in radians. Higher = card can keep rotating longer
  • ROTATION_STRENGTH: strength of rotation. Higher = weaker rotation
  • ROTATION_ANGLE: Higher = stronger rotation angle

Each component is also explained thoroughly, so it is highly customizeable in many ways

How to use

files

  • ViewController.h/m: example view controller (not necessary)
  • DraggableViewBackground.h/m: UIView that holds the DraggableView. This can be put ontop of view controllers or you can set it as the main view of your view controller
  • DraggableView.h/m: UIView of the draggable cards
  • OverlayView.h/m: UIView of the X and √ images

Setup as View Controller (see ViewController.m)

  DraggableViewBackground *draggableBackground = [[DraggableViewBackground alloc]initWithFrame:self.view.frame];
  [self.view addSubview:draggableBackground];

Setup as UIView ontop of View Controller

  CGRect frame = self.view.frame;
  frame.origin.y = -self.view.frame.size.height; //optional: if you want the view to drop down
  DraggableViewBackground *draggableBackground = [[DraggableViewBackground alloc]initWithFrame:frame];
  draggableBackground.alpha = 0; //optional: if you want the view to fade in

  [self.view addSubview:draggableBackground];

    //optional: animate down and in
  [UIView animateWithDuration:0.5 animations:^{
      draggableBackground.center = self.view.center;
      draggableBackground.alpha = 1;
  }];

Presenting Your Data

Loading Data

  • edit -(void)loadCards in DraggableViewBackground.m to dictate what information is loaded and how
  • "allCards" holds all the cards you want to show, "loadedCards" only shows the first few so that it doesn't load everything at once.
  • if card data is loaded after initWithFrame, then make sure the data is included in your custom data array (currently "exampleCardLabels") at the index: yourIndex and then write the code:

    DraggableView* newCard = [self createDraggableViewWithDataAtIndex:yourIndex];
    [allCards addObject:newCard];

    whenever you need to.

  • I used exampleCardLabels as an example of how to load data, but feel free to change that

Presenting Data in View

  • Customize the presentation of your data in -(DraggableView *)createDraggableViewWithDataAtIndex:(NSInteger)index in DraggableViewBackground.m (eg: make certain data appear on labels or photos in custom UIImageViews)
  • to access any card directly, use [loadedCards objectAtIndex:yourIndex]; For example, the card that is currently visible is at [loadedCards firstObject];

Areas for Future Improvement / Involvement

  • The repo potentially violates the MVC model by having to much controller functionality in a view (DraggableViewBackground)
  • Improved naming (while maintaining legacy and / or easy directions for change)


스와이프 제스츄어기반 카드컨트롤을 구현한 오픈소스 TinderSimpleSwipeCards 입니다.
좌우 드래그에 따른 액션을 정의해 사용할 수 있으며 아래와 같이 3가지 타입의 스와이프시 효과도 지원합니다.

[출처] https://github.com/cwRichardKim/TinderSimpleSwipeCards
?

  1. 커스텀 달력 오픈소스 - RSDayFlow

    Date2014.10.06 CategoryiOS Byhooni Views415
    Read More
  2. 코어 데이터 편집기 오픈 소스 - Core Data Editor

    Date2014.10.06 CategoryiOS Byhooni Views321
    Read More
  3. 아이패드 3D 모델링 앱 오픈소스 - Revolved

    Date2014.10.06 CategoryiOS Byhooni Views670
    Read More
  4. 커스텀 타이머 컨트롤 - DDHTimerControl

    Date2014.10.06 CategoryiOS Byhooni Views327
    Read More
  5. Swift로 개발한 캔디 크러쉬 사가 - CookieCrunch

    Date2014.10.06 CategoryiOS Byhooni Views491
    Read More
  6. Sprite Bird master 샘플 2가지

    Date2014.09.11 CategoryiOS Byhooni Views259
    Read More
  7. 스위프트로 쓰여진 트위터 오픈소스 라이브러리 - Swifter

    Date2014.07.01 CategoryiOS Byhooni Views249
    Read More
  8. Swift로 개발된 2048 게임 오픈소스 - swift-2048

    Date2014.07.01 CategoryiOS Byhooni Views387
    Read More
  9. Swift로 개발한 Flappy Bird 오픈소스 - FlappySwift

    Date2014.07.01 CategoryiOS Byhooni Views442
    Read More
  10. 줌, 커튼, 젤리 뷰변환 효과 - BCMeshTransformView

    Date2014.07.01 CategoryiOS Byhooni Views310
    Read More
  11. 메세징 라이브러리 - SOMessaging

    Date2014.07.01 CategoryiOS Byhooni Views260
    Read More
  12. 문자열 포맷형식 자동완성 Xcode 플러그인 - HOStringSense

    Date2014.07.01 CategoryiOS Byhooni Views267
    Read More
  13. 지역화 코드 자동완성 Xcode 플러그인 - Lin

    Date2014.07.01 CategoryiOS Byhooni Views259
    Read More
  14. 프로젝트에 추가된 이미지명 자동완성 Xcode 플러그인 - KSImageNamed-Xcode

    Date2014.07.01 CategoryiOS Byhooni Views251
    Read More
  15. switch 문 자동완성 Xcode 플러그인 - SCXcodeSwitchExpander

    Date2014.07.01 CategoryiOS Byhooni Views271
    Read More
  16. iOS용 아날로그 시계 오픈소스 - BEMAnalogClock

    Date2014.07.01 CategoryiOS Byhooni Views272
    Read More
Board Pagination Prev 1 2 3 4 5 ... 15 Next
/ 15