How to drag a keyboard across InteractivePopGestureRecognizer?

I was wondering how to scroll the ViewController using a visible keyboard?

in iOS 7 I can scroll the ViewController side to side, but the keyboard remains placed.

I would like to go to the following state:

enter image description here

Thanks!

+4
source share
1 answer

Update:

I can not recommend the original solution. Although it performed well (when it performed at all), it was an unreliable hack and could easily break the pose recognizer.

My colleague Dave Lyon developed a great solution using the transitions of the iOS 7 controller and packed it in a container:

https://github.com/cotap/TAPKeyboardPop

, .


:

, , , :

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.textView.inputAccessoryView = [UIView new];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    [center addObserver:self
               selector:@selector(keyboardWillHide:)
                   name:UIKeyboardWillHideNotification
                 object:nil];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)keyboardWillHide:(NSNotification *)note
{
    if (self.textView.isFirstResponder) {
        UIView *keyboardView = self.textView.inputAccessoryView.superview;
        if (keyboardView) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self.view addSubview:keyboardView];
            });
        }
    }
}

, ( addTarget:action:), , .

0

All Articles