DAKeyboardControl icon indicating copy to clipboard operation
DAKeyboardControl copied to clipboard

Fix iOS9 keyboard target.

Open AndresCanella opened this issue 10 years ago • 12 comments

Keyboard target moved, I've targeted the new location. But have not gone in deep to check how all your code works. I've not tested with older versions of iOS, but did add a check to use this fix only for iOS 9+. I apologize if my code is not super clean, I had very little time for this. Cheers.

AndresCanella avatar Sep 23 '15 00:09 AndresCanella

@AndresCanella thanks! Do you happen to know if this works with 3rd party keyboards? Will test later in any case.

danielamitay avatar Sep 23 '15 05:09 danielamitay

@danielamitay Tested and working with Swift Key and regular keyboards on iPhone 6 iOS 9.

Using these methods

- (void)addKeyboardPanningWithFrameBasedActionHandler:(DAKeyboardDidMoveBlock)didMoveFrameBasesBlock
                         constraintBasedActionHandler:(DAKeyboardDidMoveBlock)didMoveConstraintBasesBlock;
- (CGRect)keyboardFrameInView;

And these properties

keyboardFrameInView
keyboardOpened;
keyboardTriggerOffset

AndresCanella avatar Sep 23 '15 11:09 AndresCanella

@danielamitay Thanks for maintaining this DAKeyboardControl. Good stuff.

AndresCanella avatar Sep 23 '15 11:09 AndresCanella

Yes, it's working. Thanks @AndresCanella .

I like DAKeyboardController, it's better than Apple iOS7 keyboardDismissMode, specially when you have a UIToolBar.

rcmstark avatar Sep 25 '15 00:09 rcmstark

Glad to contribute.

AndresCanella avatar Sep 25 '15 00:09 AndresCanella

yup , it's work as well , but i have problem in Landscape mode , if i want to dismiss my keyboard , every thing in my view going to hidden & textField come from top of my View :| !!!

mfarhand avatar Sep 30 '15 11:09 mfarhand

Good find @mfarhand, I don't use landscape. Was this working properly before? All I did was fetch the target view from where iOS moved it to. It might change on landscape or is now treated differently in some way... If I have some free time I'll take a look.

AndresCanella avatar Sep 30 '15 11:09 AndresCanella

@AndresCanella yup , it was working properly before , but with this code all of my ( bubble ) & ... going to hidden & in touch end event my text field coming from status bar :D !!! can you check it ASAP for me ? another question why @JyaouShingan saied to use UIInputSetContainerView ? i am using this code now & called them like your code , is it ok ?

-(UIView_) findInputSetHostView { if([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0) { for(UIWindow_ window in [[UIApplication sharedApplication] windows]) if([window isKindOfClass:NSClassFromString(@"UIRemoteKeyboardWindow")]) for(UIView* subView in window.subviews) if([subView isKindOfClass:NSClassFromString(@"UIInputSetHostView")]) for(UIView* subsubView in subView.subviews) if([subsubView isKindOfClass:NSClassFromString(@"UIInputSetHostView")]) return subsubView; } else return self.keyboardActiveInput.inputAccessoryView.superview; return nil; }

you can see the screenshot http://uupload.ir/files/lgg1_img_1049.png

mfarhand avatar Sep 30 '15 11:09 mfarhand

@AndresCanella any news ?

mfarhand avatar Oct 04 '15 07:10 mfarhand

@mfarhand I'd love to contribute more but I have my hands full. Have you managed to fix it?

AndresCanella avatar Oct 09 '15 04:10 AndresCanella

@AndresCanella i have handled it only in portrait mode with this way : -(UIView_) findInputSetHostView { if([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 && [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait ) { for(UIWindow_ window in [[UIApplication sharedApplication] windows]) if([window isKindOfClass:NSClassFromString(@"UIRemoteKeyboardWindow")]) for(UIView* subView in window.subviews) if([subView isKindOfClass:NSClassFromString(@"UIInputSetHostView")]) for(UIView* subsubView in subView.subviews) if([subsubView isKindOfClass:NSClassFromString(@"UIInputSetHostView")]) return subsubView; } else return self.keyboardActiveInput.inputAccessoryView.superview; return nil; }

mfarhand avatar Oct 10 '15 05:10 mfarhand

@mfarhand You can wait till someone fixes this(who knows when), or you can try to fix it yourself.

You need to figure out what is going on with the views that are being used. For starters you could add NSLogs to all your relative views(frame.x, frame.y. frame.width..). Like the one returned by findInputSetHostView and any other being used by this for something. Eventually you will find what view is sending your view where it should not. From there you can start to think of a solution.

You can also probably find other similar frameworks that have already solved this and check what they did to fix it. Generally you can also find comments of people that have an idea of what's going on. My solution is based on a comment someone did on the original bug report thread. https://github.com/danielamitay/DAKeyboardControl/issues/95#issuecomment-140512365

P.S. Use markdown so your code comments are formatted clearly. You can also embed images.

AndresCanella avatar Oct 10 '15 15:10 AndresCanella