danielamitay / dakeyboardcontrol Goto Github PK
View Code? Open in Web Editor NEWDAKeyboardControl adds keyboard awareness and scrolling dismissal (ala iMessages app) to any view with only 1 line of code.
License: Other
DAKeyboardControl adds keyboard awareness and scrolling dismissal (ala iMessages app) to any view with only 1 line of code.
License: Other
After dragging the keyboard back down again, any scrolling taking place in the tableview causes the bottom bar to dragged up again but without the keyboard.
Also the keyboard is not visible when its slides in from the bottom, only once the animation completes
The last line in this method (self.keyboardActiveView = nil;) raises the exception.
- (void)inputKeyboardDidHide:(NSNotification *)notification {
self.keyboardActiveView.hidden = NO;
self.keyboardActiveView.userInteractionEnabled = YES;
self.keyboardActiveView = nil;
}
2013-01-01 22:53:48.152 Palaver[4645:907] *** Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'Cannot update for observer
<UIView 0x1d5db6e0> for the key path "keyboardActiveView.frame" from
<UIView 0x1d5db6e0>, most likely because the value for the key
"keyboardActiveView" has changed without an appropriate KVO notification
being sent. Check the KVO-compliance of the UIView class.'
*** First throw call stack:
(0x325382a3 0x3a1d297f 0x325381c5 0x32def4cf 0x32dc6287 0x32da06d3 0x11f6ef 0x32489037 0x32d9f599 0x343bedc5 0x34676303 0x34355abb 0x343ca8f7 0x340ffc01 0x3a5e94b7 0x3a5eadcb 0x3250bf3b 0x3247eebd 0x3247ed49 0x360402eb 0x34394309 0x35711 0x34d90)
libc++abi.dylib: terminate called throwing an exception
This is the case when a another view opens the keyboard (such as a UIAlertView).
Not sure how to reproduce, but has been showing up in my crash logs. Here is the section that has problems (line 222):
- (void)inputKeyboardDidShow
{
// Grab the keyboard view
self.keyboardActiveView = self.keyboardActiveInput.inputAccessoryView.superview; // This line causes crashes sometimes
self.keyboardActiveView.hidden = NO;
// If the active keyboard view could not be found (UITextViews...), try again
if (!self.keyboardActiveView) {
// Find the first responder on subviews and look re-assign first responder to it
[self reAssignFirstResponder];
}
}
Here are two of them:
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UICTFontDescriptor inputAccessoryView]: unrecognized selector sent to instance 0x16eeb850'
Last Exception Backtrace:
0 CoreFoundation 0x2e522f4b __exceptionPreprocess + 131
1 libobjc.A.dylib 0x38cff6af objc_exception_throw + 36
2 CoreFoundation 0x2e5268e7 -[NSObject(NSObject) doesNotRecognizeSelector:] + 200
3 CoreFoundation 0x2e5251cb ___forwarding___ + 704
4 CoreFoundation 0x2e4744d8 _CF_forwarding_prep_0 + 22
5 ChatSecure 0x00201437 -[UIView(DAKeyboardControl) inputKeyboardDidShow] (DAKeyboardControl.m:222)
6 CoreFoundation 0x2e4e5119 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 10
7 CoreFoundation 0x2e459257 _CFXNotificationPost + 1716
8 Foundation 0x2ee3ec2d -[NSNotificationCenter postNotificationName:object:userInfo:] + 74
9 UIKit 0x30d5ab89 -[UIInputViewTransition postNotificationsForTransitionEnd] + 942
10 UIKit 0x310d6e6d __53-[UIPeripheralHost(UIKitInternal) executeTransition:]_block_invoke1332 + 370
11 UIKit 0x30ccd7c9 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 282
12 UIKit 0x30ccd417 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 176
13 UIKit 0x30ccd333 -[UIViewAnimationState animationDidStop:finished:] + 68
14 QuartzCore 0x30923729 CA::Layer::run_animation_callbacks(void*) + 230
15 libdispatch.dylib 0x391e2d07 _dispatch_client_callout + 20
16 libdispatch.dylib 0x391e978d _dispatch_main_queue_callback_4CF$VARIANT$mp + 266
17 CoreFoundation 0x2e4ed819 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 6
18 CoreFoundation 0x2e4ec0ed __CFRunLoopRun + 1298
19 CoreFoundation 0x2e456c27 CFRunLoopRunSpecific + 520
20 CoreFoundation 0x2e456a0b CFRunLoopRunInMode + 104
21 GraphicsServices 0x33137283 GSEventRunModal + 136
22 UIKit 0x30cfa049 UIApplicationMain + 1134
23 ChatSecure 0x0000f667 main (main.m:31)
24 libdyld.dylib 0x39207ab7 start + 0
Here is the second one:
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x1001c
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x38cfc0ec objc_retain + 12
1 ChatSecure 0x00275423 -[UIView(DAKeyboardControl) inputKeyboardDidShow] (DAKeyboardControl.m:222)
2 CoreFoundation 0x2e4e5119 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 10
3 CoreFoundation 0x2e459257 _CFXNotificationPost + 1716
4 Foundation 0x2ee3ec2d -[NSNotificationCenter postNotificationName:object:userInfo:] + 74
5 UIKit 0x30d5ab89 -[UIInputViewTransition postNotificationsForTransitionEnd] + 942
6 UIKit 0x310d6e6d __53-[UIPeripheralHost(UIKitInternal) executeTransition:]_block_invoke1332 + 370
7 UIKit 0x30ccd7c9 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 282
8 UIKit 0x30ccd417 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 176
9 UIKit 0x30ccd333 -[UIViewAnimationState animationDidStop:finished:] + 68
10 QuartzCore 0x30923729 CA::Layer::run_animation_callbacks(void*) + 230
11 libdispatch.dylib 0x391e2d07 _dispatch_client_callout + 20
12 libdispatch.dylib 0x391e978d _dispatch_main_queue_callback_4CF$VARIANT$mp + 266
13 CoreFoundation 0x2e4ed819 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 6
14 CoreFoundation 0x2e4ec0ed __CFRunLoopRun + 1298
15 CoreFoundation 0x2e456c27 CFRunLoopRunSpecific + 520
16 CoreFoundation 0x2e456a0b CFRunLoopRunInMode + 104
17 GraphicsServices 0x33137283 GSEventRunModal + 136
18 UIKit 0x30cfa049 UIApplicationMain + 1134
19 ChatSecure 0x00083667 main (main.m:31)
20 libdyld.dylib 0x39207ab7 start + 0
I'll update the issue when more information is available.
From the readme:
[self.view addKeyboardNonpanningWithActionHandler:^(CGRect keyboardFrameInView) {
// Move interface objects accordingly
// Animation block is handled for you
}];
This is no longer the case in master. The "action handler" is now set as the keyboardDidCompleteBlock
which is only ever run on completion of the UIView animation. The keyboardDidMoveBlock
is nil in this case.
I'm profiling my app with Instruments, and there seems to be a memory leak when using the following code:
__weak UITextView *weakTextView = mainTextView;
[mainTextView addKeyboardPanningWithActionHandler:^(CGRect rect){
CGRect convertedRect = [weakTextView convertRect:rect toView:weakTextView.superview];
CGRect textRect = weakTextView.frame;
textRect.size.height = convertedRect.origin.y;
weakTextView.frame = textRect;
}];
I'm using ARC. The leak is a NSMallockBlock. Instruments is saying the leak is coming from this line:
objc_setAssociatedObject(self,
&UIViewKeyboardDidMoveBlock,
keyboardDidMoveBlock,
OBJC_ASSOCIATION_COPY);
I can't seem to figure out what the problem is, but if I comment out all lines inside the actionHandler block, then the leak doesn't occur. Can you try to replicate this?
The issue I'm running into is that when the keyboard is dismissed the toolbar goes down and disappears off the screen. Any ideas on how to fix this?
Thanks in advance.
I require either a boolean that returns YES only when the keyboard is fully opened or an action block that is called whenever the user releases the keyboard.
I would be grateful if you could add that or something better that you think of with the same purpose - track pan gesture on the keyboard. :)
How about a support for dragging keyboard up from a hidden state? THanks
We are using a split view controller that has the keyboard on it. If the keyboard is activated and the view with the keyboard is changed (but the keyboard control remains active), when hideKeyboard is called, self.keyboardActiveInput returns a deallocated text edit pointer.
Wrapping the 3 lines in hideKeyboard with:
if (self.keyboardActiveView)
{
...
}
This seems to fix this issue. Not sure if this is the best way to take care of this or if the object that self.keyboardActiveInput returns should be set to nil when "inputKeyboardDidHide" is called or something else.
Thanks for a great drop-in!
Hi, I'm usiing this DAKeyboardControl in my app for chat.
It was good and I was pleased until I found several issue. Especially this issue is very annoying and can't find why.
When I go into Chat page with this control and tap the textview to enter message, and then swipe down, it works fine, and I get out of that page, and then right go back again.
When I do this several times, sometimes just once or twice, then the keyboard freeze when I tap the textview. And it take a while like 10 secs before they keyboard active again.
I've commented all the related code and just used this control and same thing happen.
Hope someone can help me fix this issue.
Many thanks.
Using DAKeyboardControl together with MFMailComposeViewController (i.e. InApp email) results in a crash on iOS 5.x.
When responderDidBecomeActive gets called in your code, textField receives a MFComposeTextContentView object which does not respond to inputAccessoryView.
The crash report looks as follows:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MFComposeTextContentView setInputAccessoryView:]: unrecognized selector sent to instance 0x877e370'
Note: This happens when trying to edit the body of the InApp email view controller which is when the keyboard becomes active.
Regards,
Sergio
I have a UITextView inside a UITableView. I've replaced the following line in two projects now, figured it's a noteworthy change. .
DAKeyboardControl.m:320 gestureRecognizer:shouldReceiveTouch:
return (![touch.view isFirstResponder] || ([self isKindOfClass:[UITextView class]] && [self isEqual:touch.view]));
replaced with
return (![touch.view isFirstResponder] || ([touch.view isKindOfClass:[UITextView class]]));
If I swipe the keyboard down and release my finger before the keyboard is fully dismissed. The keyboard will animate off much quicker than my animated block. See video.
in
[self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {
CGRect toolBarFrame = toolbar.frame;
toolBarFrame.origin.y = keyboardFrameInView.origin.y - toolBarFrame.size.height;
toolbar.frame = toolBarFrame;
CGRect tableViewFrame = tableView.frame;
tableViewFrame.size.height = toolBarFrame.origin.y;
tableView.frame = tableViewFrame;
TLog(@"%@",NSStringFromCGRect(keyboardFrameInView));
}];
CGRect keyboardFrameInView
may be like this : {{0, -64}, {320, 252}}
When inside a tabbar controller, retracting the keyboard makes the toolbar disappear.
To truly mimic the iMessage app, DAKeyboardControl needs to support automatically resizing the scrollview/tableview otherwise when the keyboard is shown you can't scroll to the bottom of the view. I have this functionality implemented already but it breaks with DAKeyboardControl as the view does not return to full height until the keyboard has disappeared (leaving a gap whilst dragging)
2013-01-30 01:53:24.144 athlete-staging[36064:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <UIView 0x6f4990> for the key path "keyboardActiveView.frame" from <UIView 0x6f4990> because it is not registered as an observer
i was not having this trouble until the latest update
I would love if the text field expanded upwards as you typed
Hey there, love this control. However, having an issue that I think is related to autoLayout but not sure. I have copied the code from the sample:
[self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {
CGRect toolBarFrame = toolBar.frame;
toolBarFrame.origin.y = keyboardFrameInView.origin.y - toolBarFrame.size.height;
toolBar.frame = toolBarFrame;
CGRect tableViewFrame = tableView.frame;
tableViewFrame.size.height = toolBarFrame.origin.y;
tableView.frame = tableViewFrame;
}];
So I have my toolbar that starts at the bottom of the view, then moves up with the keyboard when it shows, but since adding your control the toolbar now moves 2x as (so up to the top of the keyboard + another keyboard size up). Then when I drag the table down and hide the keyboard, the toolbar is moved below the view as well.
Have you encountered this before? Any suggestions?
I am familiar a bit with auto layout but am not sure if that is the cause of this problem or not.
When I add a subview to the view, I will call
[self.view removeKeyboardControl];
to remove the keyboard control, but the text field or text view is not dismiss yet. And I re-add
[self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView){}];
when I remove the subview from the view. But the drag down to dismiss keyboard is not working :(
In my case, when I added new subviews to the view, I wanted to removeKeyboardControl and add it back after I remove the subview. May I know is there any solutions on this? Thanks!
Selecting text within a non-editable text view causes the UI to become unresponsive. Try adding this code to the DAKeyboardControl example project.
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 50, 320, 50)];
[textView setText:@"Example text to select."];
[textView setEditable:NO];
[self.view addSubview:textView];
I am using a UITextView in one of my App's controllers which doesn't rely on the functionality provided by DAKeyboardControl.
When the view containing the UITextView is presented I force the keyboard to appear right away by [self.textView becomeFirstResponder] in viewWillAppear.
This works fine in iOS5 and iOS6. However, in iOS7 this results in a crash which I traced to:
Some debugging shows that keyboardActiveInput has a stale value.
I have two workarounds for this issue:
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.textView becomeFirstResponder];
});
}
else {
[self.textView becomeFirstResponder];
}
Both solutions work with the caveat that the keyboard does not appear right away which is not desirable. This appears to be an Apple issue but I am letting you know in case you have some insight which would cause this problem in iOS7. Note that if I exclude DAKeyboardControl support from my App which I can do through a #define, the problem does not surface at all.
My apologies in advance if this is a duplicate issue or ignorance on my part.
Best regards,
Sergio
See this question on stack overflow:
http://stackoverflow.com/questions/12450539/mkmapview-panning-causes-parent-uiscrollview-to-scroll/
When you add a MKMapView (or UIScrollView) to a parent UIScrollView, the control hits the method:
even if it the control isn't being used.
To replicate this, add a control to a simple one view window. Then add the following code to the viewDidLoad:
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
[scrollView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];
// Make the content size large to allow scroll view to move
[scrollView setContentSize:CGSizeMake(1000, 2000)];
[self.view addSubview:scrollView];
double mapHeight = 200;
MKMapView *map = [[MKMapView alloc] initWithFrame:CGRectMake(0, 200, self.view.bounds.size.width, mapHeight)];
[scrollView addSubview:map];
This causes the bug to be reproduced. Contact me and I can send you a sample project which reproduces it.
When adding DAKeyboardControl
to your project via CocoaPod, the folder DAKeyboardControlExample
is added to the Pod files.
I suggest it should not.
This is a minor issue, as it did not created any problem in my project.
But in a unit test class, Xcode 4.6.3 showed an error when calling a method on my AppDelegate instance.
This is because it was loading the file AppDelegate.h
in Pods/DAKeyboardControl/DAKeyboardControlExample/DAKeyboardControlExample/
before the AppDelegate.h
of my project.
Hello everyone i have a pb. i am able to trigger this : textFieldDidBeginEditing but i cannot textFieldShouldReturn? any help :)
Hi,
Nice component! Is there a way to invoke the DAKeyboardControl only for certain textfields / input fields and not others that exist in the same view controller? Essentially, I'd like to know how to disable it and then re-enable it on the same view controller.
Thank you!
Tried running my app with DAKeyboardControl on Xcode5 DP6 , think there's a problem with the control in iOS7 alone, works fine with iOS6 and XCode4
The code accesses the panGestureRecognizer of UIScrollView. According to the header, this is available since 5.0.
Tested with 4.3 it breaks in line 53 of DAKeyboardControlTableView. No problems with 5.0 simulator.
Regards,
sunatmidnight
Hello, i want know if there is a way to detect when the UIKeyboard is completely show, because i want scroll to bottom the UIScrollView when it happens. I have a uitextview connected to the DAKeyboardControl, and i want know detect it in two ways:
it possible?
The fix for issue #9 introduces some problems with TextField and TextView delegate methods. Since it calls
[inputView resignFirstResponder];
[inputView becomeFirstResponder];
the delegate methods textViewShouldBeginEditing:, textViewDidBeginEditing:, textViewDidEndEditing:, etc. are called extra times. This causes a problem for validation or other code that might be in those methods.
First and foremost....I love this control you've created...it's perfect for a pet project I've started recently. I was wondering if you could possibly create an example for Storyboard. I tried for a bit but struggled to get it working properly.
Thanks for updating the version on CocoaPods.
Is there any particular consideration that adding the DAKeyboardControlExample to the preserve_paths? Because that would cause projects using DAKeyboard to download the DAKeyboardControlExample.
The cocoapod spec has a hard-coded commit number.
This means that anybody who used CocoaPod to install DAKeyboardControl in their project was stuck with a 5 months-old revision. This includes several tickets, with some of the crash related.
Waiting for an update on cocoapod repo, you can use this in your Podfile:
pod 'DAKeyboardControl', :podspec => 'https://raw.github.com/gcerquant/Specs/61dcb82c10fef0254934a5a010cc7ab5a2c2d0e0/DAKeyboardControl/0.0.1/DAKeyboardControl.podspec'
I have a view with a UITextField and a UITextView, these are always visible also with the keyboard opened. If i select the UITextField is all ok, i can write in that field. If after i select the UITextView, with these lines of code, you are focusing again on the old UITextField (not on the text view i selected). I think this goes in conflict with the system focus on the right responder so i see the cursor blinking on the UITextView (right) but i'm writing on the UITextField (wrong).
The main problem i think is with the UITextView, this type of responder sends the UIKeyboardDidShowNotification notification before of the UITextViewTextDidBeginEditingNotification notification.
thank you
PS: i like the way you implemented the keyboard panning gesture.
I am developing an iOS6 app and when I loaded a keyboard twice I would get unrecognized selector errors for inputKeyboardWillChangeFrame:
I commented out the method below and things started working.
// For the sake of 4.X compatibility
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(inputKeyboardWillChangeFrame:)
name:@"UIKeyboardWillChangeFrameNotification"
object:nil];
Hello, i have this uitableview:
@property (weak, nonatomic) IBOutlet UITableView *tableView;
then in the viewDidLoad i do this:
[self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {
// Move interface objects accordingly
// Animation block is handled for you
CGRect tableViewFrame = _tableView.frame;
tableViewFrame.size.height = keyboardFrameInView.origin.y;
_tableView.frame = tableViewFrame;
}];
i doesn't use self, but i however have this warning:
"Capturing self strongly in this block is likely to lead a retain cycle"
so i found this "trick":
__weak typeof(self) weakSelf = self;
[self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {
// Move interface objects accordingly
// Animation block is handled for you
CGRect tableViewFrame = weakSelf.tableView.frame;
tableViewFrame.size.height = keyboardFrameInView.origin.y;
weakSelf.tableView.frame = tableViewFrame;
}];
and i receive no warning, and seems work, but i read in the example project that i have to use this:
[self.view removeKeyboardControl];
but where i have to insert it?
Hey Daniel,
I'm having trouble using the DAKeyboardControl with my views layout
My viewController's view has 3 subviews:
I want that when the keyboard is shown, my top view & my tableView will animate up until the top view is completely hidden and the tableView y origin is 0. From this point the keyboard is still animating up so now the tableView height should get smaller until the keyboard animation is finished.
(the bottom UITextFiled should behave like in the example - stay above the keyboard)
When user pan to dismiss the keyboard the views should return to original position.
I know that this is a very specific question, but I hope u could help
Thanks
The keyboard panning action handler is not called with the appropriate frame after splitting the iPad keyboard. The updated frames are sent in the UIKeyboardDidChangeFrameNotification, but are ignored by DAKeyboardHandler.
Hi Daniel,
First of all this is a great library, thanks for sharing with the community.
I'm having some weird behavior when dismissing the keyboard and expecting the accessory view (input view? not sure what to call this) to be returned to its previous position in the screen. This is an app using a tab bar controller layout, so perhaps this is the root cause of the bug.
I can reproduce this issue on your example project by simply changing this line of code:
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]];
To this:
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]];
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObject:nav];
self.window.rootViewController = tabBarController;
If you make that modification in your example project, you should be able to see the problem. Click the text field and the keyboard will be presented, the input view will slide with it beautifully, but then when you dismiss the keyboard the input view will disappear (presumably below the tab bar).
Am I missing a really obvious thing here to avoid this problem? Any help here would be appreciated.
--Joao
Hi, I have a problem with keyboard color.
I'm using keyboardAppearance property to change color to transparent. But after integrating
DAKeyboardControl this code stop working.
textField.keyboardAppearance = UIKeyboardAppearanceAlert;
Can something be done, maybe there's some workaround?
Thanks,
Dmitry.
Hi,
I use DAKeyboardControl on a chat view controller and i noticed that when i do a lot of tap on the UItableView above the keyboard ( 5/6 tap ) my app crash.
I saw on Xcode the CPU of my iPhone is 100% used before the crash.
I have a crash on DAKeyboardControl.m ( ie: attached screenshot).
I use the code like this :
__unsafe_unretained typeof(self) weakSelf = self;
[self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {
CGRect toolBarFrame = weakSelf->toolBar.frame;
toolBarFrame.origin.y = keyboardFrameInView.origin.y - toolBarFrame.size.height ;
if(weakSelf->keyboardShowing){
weakSelf->toolBar.frame = toolBarFrame;
}
CGRect tableViewFrame = weakSelf->chatTableView.frame;
tableViewFrame.size.height = toolBarFrame.origin.y - 68.0f;
weakSelf->chatTableView.frame = tableViewFrame;
}];
I would be grateful if you if you can help me.
Thanks, DrewDe
My app (MUDRammer - a Modern MUD Client for iPhone and iPad) depends on DAKeyboardControl for repositioning its input bar when the keyboard shows and hides. Thanks very much for a great component.
Is there a general solution for iPad split and undocked keyboards? These actions either don't generate the standard UIKeyboardWillShowNotification
/ UIKeyboardWillHideNotification
notifications -- or generate only a subset of them -- and DAKeyboardControl is calling my action handler block with some peculiar keyboard frames:
{{9.86076e-32, -64}, {0, 0}}
(Initial call, when first undocked or split)
{{7.08514e-32, -64}, {3.01408e-17, 0}}
(After dragging the keyboard around for a while)
This tends to corrupt my app's layout. On the bright side, I am able to recover my layout if the keyboard is re-docked (or un-split) because the rects passed into my action handler are sane again.
Merely including DAKeyboardControl in a project breaks MFMessageComposeViewController under iOS 5: when the view appears, the message text input field is not visible. If a list of recipients has also been set via code, then the text field appears initially, but disappears as soon as the user taps the recipient field.
It seems that the "null" input accessory view that DAKeyboardControl sets interacts badly with MFMessageComposeViewController. I've been able to fix the missing input field with the following ugly hack. Not sure if this is the right way though:
- (void)swizzled_addSubview:(UIView *)subview
{
if (([subview isKindOfClass:[UITextView class]] || [subview isKindOfClass:[UITextField class]]) &&
strcmp(object_getClassName(subview), "MFRecipientTextField") != 0)
{
No problems on iOS 6, presumably due to the new remote view controllers.
I have recorded a video to explain, this is really easy to reproduce.
I have also managed to reproduce this by swiping up in the gesture recogniser (but not as often).
When the keyboard is opened from a UITextView instead of a UITextField, it doesn't work.
activeInput.inputAccessoryView.superview is nil, so the activeKeyboard-ivar isn't set.
Hi there,
I was trying to use DAKeyboardControl, but my App crashes after the second load of DAKeyboardControl.
To show what I mean, I modified the Example project. You can find it here:
https://github.com/appcominteractive/DAKeyboardControl/tree/swizzeledError
To see the crash: push the new push button, go back, and press the push button again.
Tested with Xcode 4.5.2 on iPhone 5.0 and iPhone 6.0 Simulator.
Regards,
Christian
Pan down the keyboard half way and then pan up the keyboard again. This will cause the UITextView height to be wrong.
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect frame = self.view.bounds;
self.textView = [[UITextView alloc] initWithFrame:frame];
self.textView.keyboardAppearance = UIKeyboardAppearanceDark;
[self.view addSubview:self.textView];
__weak typeof(self) weakSelf = self;
[self.textView addKeyboardPanningWithFrameBasedActionHandler:^(CGRect keyboardFrameInView, BOOL opening, BOOL closing) {
CGRect textViewFrame = weakSelf.textView.frame;
textViewFrame.size.height = keyboardFrameInView.origin.y;
weakSelf.textView.frame = textViewFrame;
} constraintBasedActionHandler:nil];
}
Can you add a tag for the version 2.3.1? I'm trying to update the cocoa pods specs to merge the changes i did in my project.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.