Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iOS9 keyboard target. #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AndresCanella
Copy link

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.

Keyboard target moved, take
@AndresCanella AndresCanella mentioned this pull request Sep 23, 2015
@danielamitay
Copy link
Owner

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

@AndresCanella
Copy link
Author

@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
Copy link
Author

@danielamitay Thanks for maintaining this DAKeyboardControl. Good stuff.

for(UIWindow* window in [[UIApplication sharedApplication] windows])
if([window isKindOfClass:NSClassFromString(@"UIRemoteKeyboardWindow")])
for(UIView* subView in window.subviews)
if([subView isKindOfClass:NSClassFromString(@"UIInputSetHostView")])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--The class name here should be "UIInputSetContainerView"
Nvm this way seems works as well

@rcmstark
Copy link

Yes, it's working. Thanks @AndresCanella .

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

@AndresCanella
Copy link
Author

Glad to contribute.

@mfarhand
Copy link

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 :| !!!

@AndresCanella
Copy link
Author

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.

@mfarhand
Copy link

@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
Copy link

mfarhand commented Oct 4, 2015

@AndresCanella any news ?

@AndresCanella
Copy link
Author

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

@mfarhand
Copy link

@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;
}

@AndresCanella
Copy link
Author

@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. #95 (comment)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants