Coder Social home page Coder Social logo

iamrmohamed / amkeyboardframetracker Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 7.0 135 KB

Simple iOS Keyboard frame tracker for custom interactive Keyboard dismissal

License: MIT License

Ruby 10.95% Swift 89.05%
inputaccessoryview uiscrollview uitabbarcontroller

amkeyboardframetracker's People

Contributors

gsbernstein avatar iamrmohamed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

amkeyboardframetracker's Issues

Bottom padding in keyboard dismiss

ezgif com-crop

My code:

@IBOutlet weak var viewMsgInput: UIView!
@IBOutlet weak var msgComBottomSpace: NSLayoutConstraint!
@IBOutlet weak var txtMessage: GrowingTextView!

var keyboardFrameTrackerView = AMKeyboardFrameTrackerView.init() 

override func viewDidLoad() {
        super.viewDidLoad()
self.keyboardFrameTrackerView = AMKeyboardFrameTrackerView.init(height: self.viewMsgInput.frame.height)
        self.txtMessage.inputAccessoryView = self.keyboardFrameTrackerView
        self.keyboardFrameTrackerView.delegate = self
}

extension ChatMessageVC: AMKeyboardFrameTrackerDelegate {
    func keyboardFrameDidChange(with frame: CGRect) {
        
        let vFrame_Height =  self.view.frame.height
        let bottomSapcing = vFrame_Height - frame.origin.y - self.keyboardFrameTrackerView.frame.height
        
        self.msgComBottomSpace.constant = (bottomSapcing > 0) ? bottomSapcing : 0
        self.view.layoutIfNeeded()
    }
}

What wrong in my code ??
Please respond.
Thanks

More information for the `README.md`.

Not a big deal, but when using the library, it behaved wrongly(the input view was leaving too much space than it actually needed) because of the IQKeyboardManager library that I was using.

I had to add the view controller that I was using this library with to the ignore list of the IQKeyboardManager like following so:

IQKeyboardManager.shared.disabledDistanceHandlingClasses.append(ViewControllerType.self)

In my opinion, it would be great to mention this in the README.md file. It took a while for me to find out what was the issue :).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.