动画 + 设置contentoffset,然后就 蛋疼了,

[UIViewbeginAnimations:nilcontext:nil];

        [UIViewsetAnimationDelegate:self];

        [UIViewsetAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];

        [UIViewsetAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];

        //upperview

        if (kContentSize.height == 0) {

            kContentSize.height = kDefaultContentSizeHeight;

        }

        bottomView.frame = CGRectMake(bottomView.frame.origin.x, self.contentView.frame.size.height - keyboardHeight - kContentSize.height - textViewBgAndCursor*2, bottomView.frame.size.width, kContentSize.height + textViewBgAndCursor * 2);

        buyView.frame = CGRectMake(buyView.frame.origin.x,bottomView.frame.origin.y - buyView.frame.size.height, buyView.frame.size.width, buyView.frame.size.height);

        //tableview

        self.tableView.frame = CGRectMake(self.tableView.frame.origin.x, 44 - keyboardHeight, self.tableView.frame.size.width, self.tableView.frame.size.height);

        [selfadjustTableViewContentOffSetWhenShowboard];

        [UIViewcommitAnimations];

原文地址:https://www.cnblogs.com/guligei/p/3645142.html