Comments (10)
Yes, I have experienced issues with "recent versions of iOS ;)" too.
The code is running into a loop between -inputKeyboardDidShow:
and -reAssignFirstResponder
.
from dakeyboardcontrol.
DAKeyboardControl
will change a bit for iOS7 once we're out of the NDA, so I'm definitely looking into it.
from dakeyboardcontrol.
hi
any updates on this i am having the same issue
from dakeyboardcontrol.
Take a look at d6def98. It is by no means complete support for iOS7, but a good first step.
Can anyone provide a reproducible example? Unfortunately I cannot reproduce this -inputKeyboardDidShow:
and -reAssignFirstResponder
loop.
from dakeyboardcontrol.
For me it occurred when I had two inputs, selected one (bringing the keyboard up) and then changed to the other one by tapping on it. I'll see if I can create a sample project later today.
from dakeyboardcontrol.
Regarding the iOS7 support: I don't like the UIScrollViewKeyboardDismissModeInteractive
much, at least not how it is now.
I could live with the need for a scrollView, but the implementation is very buggy right now. For a starter, dragging the keyboard around does not produce any UIKeyboardDidChangeFrameNotification
s, which makes it very much inferior to what DAKeyboardControl is capable of atm.
Also the sequence in which notifications are sent is messed up when hiding the keyboard via panning (eg it sends a UIKeyboardWillShow notification when dismissing the keyboard, with target rect set to GCRectZero, and then a UIKeyboardWillHide notification with very short animation duration).
from dakeyboardcontrol.
I have solved the loop problem with the next code:
- (void)reAssignFirstResponder
{
// Find first responder
UIView *inputView = [self recursiveFindFirstResponder:self];
if (inputView != nil)
{
// Re assign the focus
[inputView resignFirstResponder];
if( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ){
dispatch_async(dispatch_get_main_queue(), ^{
[inputView becomeFirstResponder];
});
}
else{
[inputView becomeFirstResponder];
}
}
}
It is not great, but quick for production.
from dakeyboardcontrol.
The keyboard seems to be animating on iOS 7 with a undocumented animation curve. (integer value 7)
while the animation curve is undocumented you can still pass it along like so.
This will make the opening and closing animations smoother.
static inline UIViewAnimationOptions AnimationOptionsForCurve(UIViewAnimationCurve curve)
{
switch (curve) {
case UIViewAnimationCurveEaseInOut:
return UIViewAnimationOptionCurveEaseInOut;
break;
case UIViewAnimationCurveEaseIn:
return UIViewAnimationOptionCurveEaseIn;
break;
case UIViewAnimationCurveEaseOut:
return UIViewAnimationOptionCurveEaseOut;
break;
case UIViewAnimationCurveLinear:
return UIViewAnimationOptionCurveLinear;
break;
default:
// needed change for iOS 7
return (UIViewAnimationOptions) curve<< 16;
break;
}
}
from dakeyboardcontrol.
I can reproduce this in the example by adding a UITextView
git diff
diff --git a/DAKeyboardControlExample/DAKeyboardControlExample/ViewController.m b/DAKeyboardControlExample/DAKeyboardControlExample/ViewController.m
index 8f990fb..9adefe7 100644
--- a/DAKeyboardControlExample/DAKeyboardControlExample/ViewController.m
+++ b/DAKeyboardControlExample/DAKeyboardControlExample/ViewController.m
@@ -21,11 +21,29 @@
self.title = @"DAKeyboardControl";
self.view.backgroundColor = [UIColor lightGrayColor];
-
+
+
+ UIToolbar *toolBar1 = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0f,
+ 64.0f,
+ self.view.bounds.size.width,
+ 40.0f)];
+ toolBar1.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
+ [self.view addSubview:toolBar1];
+
+ UITextField *textField1 = [[UITextField alloc] initWithFrame:CGRectMake(10.0f,
+ 6.0f,
+ toolBar1.bounds.size.width - 20.0f - 68.0f,
+ 30.0f)];
+ textField1.borderStyle = UITextBorderStyleRoundedRect;
+ textField1.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+ [toolBar1 addSubview:textField1];
+
+
+
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0.0f,
- 0.0f,
+ toolBar1.frame.origin.y+toolBar1.frame.size.height,
self.view.bounds.size.width,
- self.view.bounds.size.height - 40.0f)];
+ self.view.bounds.size.height - 80.0f)];
tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:tableView];
@@ -36,11 +54,11 @@
toolBar.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleWidth;
[self.view addSubview:toolBar];
- UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10.0f,
+ UITextView *textField = [[UITextView alloc] initWithFrame:CGRectMake(10.0f,
6.0f,
toolBar.bounds.size.width - 20.0f - 68.0f,
30.0f)];
- textField.borderStyle = UITextBorderStyleRoundedRect;
+ //textField.borderStyle = UITextBorderStyleRoundedRect;
textField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[toolBar addSubview:textField];
from dakeyboardcontrol.
Any plans to fix this issue?
My suggestion
diff --git a/DAKeyboardControl/DAKeyboardControl.m b/DAKeyboardControl/DAKeyboardControl.m
index 24cc650..4336fa4 100644
--- a/DAKeyboardControl/DAKeyboardControl.m
+++ b/DAKeyboardControl/DAKeyboardControl.m
@@ -427,7 +427,9 @@ static char UIViewIsPanning;
if (inputView != nil) {
// Re assign the focus
[inputView resignFirstResponder];
- [inputView becomeFirstResponder];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [inputView becomeFirstResponder];
+ });
}
}
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.