Skip to content

Commit

Permalink
Merge pull request #66 from m-revetria/master
Browse files Browse the repository at this point in the history
Fixed issue with tableVIew's bottom inset when keyboard is dismissed
  • Loading branch information
m-revetria committed Oct 29, 2015
2 parents c3e14ab + 9c860f9 commit f96382f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Source/Core.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ public class FormViewController : UIViewController, FormViewControllerProtocol {

//MARK: Private

private var oldBottomInset : CGFloat = 0.0
private var oldBottomInset : CGFloat?
}

extension FormViewController : UITableViewDelegate {
Expand Down Expand Up @@ -2004,7 +2004,7 @@ extension FormViewController {
let newBottomInset = table.frame.origin.y + table.frame.size.height - keyBoardFrame.origin.y
var tableInsets = table.contentInset
var scrollIndicatorInsets = table.scrollIndicatorInsets
oldBottomInset = oldBottomInset != 0.0 ? oldBottomInset : tableInsets.bottom
oldBottomInset = oldBottomInset ?? tableInsets.bottom
if newBottomInset > oldBottomInset {
tableInsets.bottom = newBottomInset
scrollIndicatorInsets.bottom = tableInsets.bottom
Expand All @@ -2025,9 +2025,11 @@ extension FormViewController {
let keyBoardInfo = notification.userInfo!
var tableInsets = table.contentInset
var scrollIndicatorInsets = table.scrollIndicatorInsets
tableInsets.bottom = oldBottomInset
scrollIndicatorInsets.bottom = oldBottomInset
oldBottomInset = 0.0
if let oldBottomInset = oldBottomInset {
tableInsets.bottom = oldBottomInset
scrollIndicatorInsets.bottom = tableInsets.bottom
}
oldBottomInset = nil
UIView.beginAnimations(nil, context: nil)
UIView.setAnimationDuration(keyBoardInfo[UIKeyboardAnimationDurationUserInfoKey]!.doubleValue)
UIView.setAnimationCurve(UIViewAnimationCurve(rawValue: keyBoardInfo[UIKeyboardAnimationCurveUserInfoKey]!.integerValue)!)
Expand Down

0 comments on commit f96382f

Please sign in to comment.