Comments (2)
I personally do not use Storyboards/AutoLayout, so if someone else would like to supply an example, that would be great!
from dakeyboardcontrol.
Here's an example of doing this with AutoLayout:
Say you have a constraint fixing a UIView to the bottom of the screen, and we want this view to 'follow' the keyboard as we drag it down:
[self.view addKeyboardPanningWithFrameBasedActionHandler:nil
constraintBasedActionHandler:^(CGRect keyboardFrameInView, BOOL opening, BOOL closing)
{
NSLog(@"constraint handler: %f", keyboardFrameInView.origin.y);
__typeof__(self) strongSelf = weakSelf;
if (strongSelf)
{
strongSelf.inputFieldBottomConstraint.constant = strongSelf.view.frame.size.height - keyboardFrameInView.origin.y;
[strongSelf.view layoutIfNeeded];
}
}];
If it doesn't work its probably a good idea to test if the Autolayout constraint is correct.
from dakeyboardcontrol.
Related Issues (20)
- Can't add self as subview HOT 2
- change it in swift code
- Support for iOS11 HOT 2
- Memory Issue HOT 2
- TextView in the nextview
- wrong origin in iPhone 6plus
- How to hide keyboard when scrolling tableview? HOT 1
- Action handler called twice when text view becomes first responder HOT 4
- UITextView custom inputaccessoryview doesn't show initially
- iPad Modal - Keyboard disappearing causes message view to move below modal lower bounds and out of view HOT 1
- iPad Modal - Gap between view and keyboard when rotated from Portrait to Landscape Orientation (iOS 8)
- Switching between UITextField/UITextView with different UITextAutocorrectionType (i.e. Suggestions bar) causes gap between keyboard and attached view
- frameBasedKeyboardDidMoveBlock is never called with closing = YES in iOS7
- keyboardActiveView is hidden
- ios8 UIScrollViewKeyboardDismissModeInteractive solution HOT 1
- iOS 9 support HOT 10
- How to disable and enable keyboardControl like IQKeyboardManager ? HOT 1
- Not working right in iOS9 (Xcode7) HOT 2
- crashed when run unittests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dakeyboardcontrol.