swipe gesture bug fixes

the previous text view content size doesn't get reset every time
editing starts.

scrollview insets work now when the keyboard is minimized.
This commit is contained in:
andrew lattis
2013-03-05 14:03:22 -06:00
parent 7c0578da68
commit 947ec74c9e

View File

@@ -70,10 +70,10 @@
// Swipe guesture for pull to hide keyboard
// Too buggy, needs work
//UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
//swipe.direction = UISwipeGestureRecognizerDirectionDown;
//swipe.numberOfTouchesRequired = 1;
//[self.inputView addGestureRecognizer:swipe];
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
swipe.direction = UISwipeGestureRecognizerDirectionDown;
swipe.numberOfTouchesRequired = 1;
[self.inputView addGestureRecognizer:swipe];
}
#pragma mark - View lifecycle
@@ -218,7 +218,8 @@
- (void)textViewDidBeginEditing:(UITextView *)textView
{
[textView becomeFirstResponder];
self.previousTextViewContentHeight = textView.contentSize.height;
if (!self.previousTextViewContentHeight)
self.previousTextViewContentHeight = textView.contentSize.height;
[self scrollToBottomAnimated:YES];
}
@@ -287,14 +288,15 @@
keyboardY - inputViewFrame.size.height,
inputViewFrame.size.width,
inputViewFrame.size.height);
UIEdgeInsets insets = UIEdgeInsetsMake(0.0f,
0.0f,
self.view.frame.size.height - keyboardY,
self.view.frame.size.height - self.inputView.frame.origin.y - INPUT_HEIGHT,
0.0f);
self.tableView.contentInset = insets;
self.tableView.scrollIndicatorInsets = insets;
[UIView commitAnimations];
}