Skip to content

Commit

Permalink
Add info about interactions to README
Browse files Browse the repository at this point in the history
  • Loading branch information
Collin Ruffenach committed Mar 17, 2014
1 parent 86d133c commit b233917
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Generates this
![](screenshots/red_notification.gif)
## Customization
`CRToast` is very customizable. Taking a hint from `UIStringDrawing`'s `drawInRect:withAttributes:` book, notifications are created with dictionaries filled with all their options.
Expand Down Expand Up @@ -79,6 +78,50 @@ Title and Subtitle text with:
- Direction (Enter and exit in any direction)
- Enter, Stay on Screen and Exit Timing
### Touch Interactions
`CRToast` allows for any notification to respond to different types of touch interactions (tap, swipe). Interaction responders can be set as defaults or on a per notification basis.
The types of interactions you can set up to respond to are:
```Obj-C
CRToastInteractionTypeSwipeUp
CRToastInteractionTypeSwipeLeft
CRToastInteractionTypeSwipeDown
CRToastInteractionTypeSwipeRight
CRToastInteractionTypeTapOnce
CRToastInteractionTypeTapTwice
CRToastInteractionTypeTwoFingerTapOnce
CRToastInteractionTypeTwoFingerTapTwice
```

There are also wild card interaction types which cover a range of interactions

```Obj-C
CRToastInteractionTypeSwipe
CRToastInteractionTypeTap
CRToastInteractionTypeAll
```

Any interaction can be responded to using a `CRToastInteractionResponder`, they can be made with the following constructor

```
+ (instancetype)interactionResponderWithInteractionType:(CRToastInteractionType)interactionType
automaticallyDismiss:(BOOL)automaticallyDismiss
block:(void (^)(CRToastInteractionType interactionType))block;
```

You can set a collection of `CRToastInteractionResponder`s as the object for the key `kCRToastInteractionRespondersKey` in defaults to have all notifications respond to a certain interaction, or on any given one to have the interaction responders just work for that one notification.

### Persistent and Programmatically Dismissed Notifications

You can also dismiss the current notification at any time with

```
+ (void)dismissNotification:(BOOL)animated;
```

You can present notifications that must be dismissed by the user by passing `@(DBL_MAX)` for `kCRToastTimeIntervalKey` and setting up an interaction responder that will dismiss the notification.

### Setting Defaults

There are sane defaults set for all properties, however you can set a default set of options for your application's notifications using `CRToastManagers`'s `setDefaultOptions:`.
Expand Down

0 comments on commit b233917

Please sign in to comment.