I wrap everything in one class. Just call these lines of code when your viewcontroller is loaded:
- (void)viewDidLoad {
[super viewDidLoad];
KeyboardInsetScrollView *injectView = [[KeyboardInsetScrollView alloc] init];
[injectView injectToView:self.view withRootView:self.view];
}
Here is link of sample project:
https://github.com/caohuuloc/KeyboardInsetScrollView