Comments (7)
I resolved this by adding a placeholder (empty) view as the UITextView's inputAccessoryView.
from dakeyboardcontrol.
Yes, this works greats for UITextField's, but not for UITextView's.
It's reproducable with the following steps:
- open PlainViewController.xib
- also add a UITextView
- run in simulator
- make the UITextView the firstresponder by clicking in it.
Now the keyboard is shown, but it doesn't slide away. By placing a Breakpoint on line 98 of DAKeyboardControlView.m I discovered the following things:
- activeInput is the correct UITextView
- activeInput.inputAccessoryView is indeed the empty placeholder
- activeInput.inputAccessoryView.superview is nil instead of the keyboard.
from dakeyboardcontrol.
I spent a lot of time trying to figure out this issue. For whatever reason, setting the inputAccessoryView
to the UITextView when it becomes active does not work as it does for a UITextField. However, setting the inputAccessoryView
before the UITextView becomes active should work (as jhersh recommended).
I have completely rebuilt DAKeyboardControl to be a category on UIView, and to be block-based. Check it out!
In this new version, I have managed to support grabbing the keyboard view from a UITextView by checking whether the keyboard view exists at the end of keyboardDidShow:
, and trying again. See below:
// If the active keyboard view could not be found (UITextViews...), try again
if (!self.keyboardActiveView)
{
[self.keyboardActiveInput resignFirstResponder];
[self.keyboardActiveInput becomeFirstResponder];
}
This occurrence is imperceptible to the user.
from dakeyboardcontrol.
Thanks @danielamitay! Just updated my app to your latest release and it's working great. I was also able to remove the empty placeholder view from my UITextView's inputAccessoryView.
from dakeyboardcontrol.
Awesome! Also, is this an app on the App Store? If so, could I get the name/promo code? I would eventually like to put a list of apps in the README.
from dakeyboardcontrol.
It's a messaging app, basically code-complete but not releasable for other reasons. I'll follow up when it's on the store, possibly later this year.
from dakeyboardcontrol.
Is this working for everyone now? I have a UITextView , which when called brings up my custom input accessory view but its position is not on top of the keyboard. When i drag the auto-translate bar on the keyboard it gets set correctly.So every time on the initial call the input accessory view is placed on top of the keyboard, on interaction with the keyboard it gets set correctly.
I currently used the following code snippets only
self.view.keyboardTriggerOffset = keyboardView.bounds.size.height;
[self.view addKeyboardPanningWithFrameBasedActionHandler:^(CGRect keyboardFrameInView, BOOL opening, BOOL closing) {
CGRect toolBarFrame = keyboardView.frame;
toolBarFrame.origin.y = keyboardFrameInView.origin.y - toolBarFrame.size.height;
keyboardView.frame = toolBarFrame;
} constraintBasedActionHandler:nil];
I also call the
[textView setInputAccessoryView:keyboardView];
in the UITextView shouldbegin method
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
- Possible to create example using Storyboard and AutoLayout? HOT 2
- 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.