Git Product home page Git Product logo

Comments (10)

ahti avatar ahti commented on August 15, 2024

Yes, I have experienced issues with "recent versions of iOS ;)" too.
The code is running into a loop between -inputKeyboardDidShow: and -reAssignFirstResponder.

from dakeyboardcontrol.

danielamitay avatar danielamitay commented on August 15, 2024

DAKeyboardControl will change a bit for iOS7 once we're out of the NDA, so I'm definitely looking into it.

from dakeyboardcontrol.

crivera avatar crivera commented on August 15, 2024

hi

any updates on this i am having the same issue

from dakeyboardcontrol.

danielamitay avatar danielamitay commented on August 15, 2024

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.

ahti avatar ahti commented on August 15, 2024

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.

ahti avatar ahti commented on August 15, 2024

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 UIKeyboardDidChangeFrameNotifications, 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.

proforov avatar proforov commented on August 15, 2024

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.

knightmj avatar knightmj commented on August 15, 2024

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.

prasanthu avatar prasanthu commented on August 15, 2024

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.

prasanthu avatar prasanthu commented on August 15, 2024

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)

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.