Permalink
Browse files

now supports fields that are grandchildren of the scrollview

  • Loading branch information...
1 parent eaec6f0 commit 0f1aad7fafa65eac0e7baadd34dc773c718cef9c @wordofchristian wordofchristian committed Jun 9, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 TPKeyboardAvoidingScrollView.m
@@ -111,7 +111,12 @@ - (UIView*)findFirstResponderBeneathView:(UIView*)view {
-(CGFloat)idealOffsetForView:(UIView *)view withSpace:(CGFloat)space
{
- CGFloat offset = view.frame.origin.y;
+ //Convert the rect to get the view's distance from the top of the scrollView.
+ CGRect rect = [view convertRect:view.bounds toView:self];
+
+ //set starting offset to that point
+ CGFloat offset = rect.origin.y;
+
if ( self.contentSize.height - offset < space ) {
// Scroll to the bottom

0 comments on commit 0f1aad7

Please sign in to comment.