Open Sean-Wang opened 10 years ago
@datwelk Please help me fix the problem, thanks.
You should not use RDRStickyKeyboardView inside a UITableViewController.
The UITableViewController
adds zero value compared to UIViewController
, because RDRStickyKeyboardView
automatically adjusts the contentOffset
of the tableview. Plus, the problem with UITableViewController
is that its view property equals its tableview property. If you provide RDRStickyKeyboardView
with a UITableViewController
's tableview, it will add the tableview as a subview to itself, while it already is a subview of the tableview. See line 569 inside RDRStickyKeyboardView.m
.
I'm sorry. I'd like to set the record straight, I use RDRStickyKeyboardView inside a UIViewController, but UIViewController contain UITableView.
self.contentWrapper = [[RDRStickyKeyboardView alloc] initWithScrollView:self.commentTableView];
self.contentWrapper.frame = self.view.bounds;
self.contentWrapper.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
[self.contentWrapper.inputView.rightButton addTarget:self action:@selector(postCommentToServers) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.contentWrapper];
You have an example project demonstrating the crash I can take a look at?
Modify the RDRStickyKeyboardView's demo according to my project process, it works well.
But, if I delete the code in the RDRStickyKeyboardView.m
NSCAssert(!(CGRectEqualToRect(keyboardFrame, CGRectZero) && self.inputViewKeyboard.superview == nil), nil);
My project will not crash.
Added RDRStickyKeyboardView in UITableViewController.
Perform the following steps:
1, Call
[self.contentWrapper showKeyboard];
when enter into UITableViewController;2, Exit UITableViewController;
3, Enter into UITableViewController again;
4, Enter any letter, RDRStickyKeyboardView Crash.