NgKeyboardTracker
  • March 11, 2024

Objective-c library for tracking keyboard in iOS apps.

Adding to your project


 

pod ‘NgKeyboardTracker’

To manually add to your projects:

  1. Add files in NgKeyboardTracker folder to your project.
  2. Add these frameworks to your project: UIKit.

Features


NgKeyboardTracker encapsulates keyboard tracking for iOS apps. It provides convenience to query keyboard’s properties anywhere in your application.

You can also use NgKeyboardTracker to implement iMessage’s text input behavior on iOS 7 (UIScrollViewKeyboardDismissModeInteractive + persistent inputAccessoryView) using NgPseudoInputAccessoryViewCoordinator.

Usage


Start and stop keyboard tracking

In your application delegate:

– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[NgKeyboardTracker sharedTracker] start]; // start tracking
return YES;
}

– (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
[[NgKeyboardTracker sharedTracker] stop]; // stop tracking
}

Responding to keyboard updates

  1. Implement NgKeyboardTrackerDelegate protocol.
  2. Register as delegate by calling -addDelegate: method
  3. Make sure to call -removeDelegate: to stop receiving keyboard updates

Keyboard tracker’s properties:

  • appearanceState : current appearance state
  • beginFrame : last known begin frame
  • endFrame: last known frame
  • currentFrame: last known current keyboard’s frame
  • animationDuration: last known animation duration
  • animationCurve: last known animation curve
  • animationOptions : derived from animationCurve for convenience

P.S. keyboard’s frame.size.height system’s keyboard height plus inputAccessoryView height.

Pseudo input accessory view coordinator

NgPseudoInputAccessoryViewCoordinator is NgKeyboardTracker extension that makes it easier to implement iMessage’s text input behavior in iOS 7 with UIScrollViewKeyboardDismissModeInteractive and persistent inputAccessoryView.

The view controller:

  1. Override loadView to set custom UIView implementation.
  2. Make sure to call the custom view’s becomeFirstResponder.

GitHub


View Github

#keyboard #menu #text
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS