Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
[README] Specify objective-c syntax to highlight the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslanskorb committed Nov 19, 2015
1 parent c474106 commit af5e73e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@ Working with iOS keyboard demands a lot of duplicated code. This category allows
## Example
Imagine that you need to implement chat-like input over keyboard. OK, import this category.

#import <RSKKeyboardAnimationObserver/RSKKeyboardAnimationObserver.h>
``` objective-c
#import <RSKKeyboardAnimationObserver/RSKKeyboardAnimationObserver.h>
```

Then make autolayout constraint between your input bottom and superview botton in *Interface Builder*, connect it with your view controller implementation through *IBOutlet*.

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *chatInputBottomSpace;
``` objective-c
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *chatInputBottomSpace;
```

Then subscribe to keyboard in the place you like (**viewDidAppear** is the best place really).

```
``` objective-c
__weak typeof(self) weakSelf = self;
[self rsk_subscribeKeyboardWithWillShowOrHideAnimation:^(CGRect keyboardRectEnd, NSTimeInterval duration, BOOL isShowing) {
__strong typeof(self) strongSelf = weakSelf;
Expand All @@ -62,7 +66,7 @@ That’s all!
For more complex behaviour (like in demo section) you can use extended API call with **before animation** section.
```
``` objective-c
__weak typeof(self) weakSelf = self;
[self rsk_subscribeKeyboardWithBeforeWillShowOrHideAnimation:^(CGRect keyboardRectEnd, NSTimeInterval duration, BOOL isShowing) {
__strong typeof(self) strongSelf = weakSelf;
Expand Down

0 comments on commit af5e73e

Please sign in to comment.