Open robdigital opened 9 years ago
To work around this, you can assign the autoCompleteParentView
to the self.view
(the parent of your UITableViewController) and change the autoCompleteTableOriginOffset
to the mapped values. This might not work when scrolling is involved.
For example:
// Parent correction
textField.autoCompleteParentView = self.view;
// Offset correction
CGPoint pt = [textField convertPoint:CGPointMake(0, textField.frame.origin.y) toView:self.view];
textField.autoCompleteTableOriginOffset = CGSizeMake(0, pt.y);
I'm having the same issue - however I can't find the autoCompleteParentView field. Are you sure thats the correct name?
OH! I am sorry!
One of our developers added this property and I did not check for that.
It might be good to prepare a pull request for that :hushed:
Hi, I have the same issue. After some investigation i have such info regarding the issue:
@theoriginalgri Thank you!!! Your solution with parentView worked perfect!!!
+1
@theoriginalgri could you please merge the changes you mentioned regarding parentView? It would be great to have it by default in pod.
Thank you beforehand.
@theoriginalgri @EddyBorja This still doesn't work for me... when I set the parent view to self.view
, that is the tableview's superview, the bottom half of the autocomplete list still cannot accept touches other than the top half.. Could someone assist further please? Thank you
I have tried to solve a more general problem: Problem: The autoCompleteTableView being outside of the parent view of the MLPAutoCompleteTextField, thus not responding to touch events. Solution: Expanding the hittable area of MLPAutoCompleteTextField's parent view like described in this link (the hit test considers the autoCompleteTableView's boundaries): https://stackoverflow.com/questions/11770743/capturing-touches-on-a-subview-outside-the-frame-of-its-superview-using-hittest The Swift approach for the parent view looks something like this:
class MLPAutoCompleteTextFieldParentView: UIView {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if clipsToBounds || isHidden || alpha == 0 {
return nil
}
for subview in subviews.reversed() {
let subPoint = subview.convert(point, from: self)
if let result = subview.hitTest(subPoint, with: event) {
return result
}
}
return nil
}
}
I have tested this approach when the MLPAutoCompleteTextField is inside a tableView.
I'm using MLPAutoComplete TextFields in my project, in several textfields in dynamic table cells. It works perfectly when the cell's row is large enough to fit the entire AutoCompleteTableView (scrollable list of suggestions). However, if the row height is smaller than the auto suggestion window, the user interaction is not being picked up by the 'scrollable auto suggstion window' and instead of scrolling through the suggestions, it is making my tableview scroll.
I've played around with z indexes, bringing the textfield and autocomplete views to the front of super, which doesn't make any difference.
I've also tried setting EnableUserInteraction = NO on the tableview after the autocomplete is triggered, which only has the effect of making the scrollview unresponsive even though its own property of EnableUserInteraction is still set to YES.
I'm thinking that because I also use TPKeyboardAvoiding in my project, that it is somehow complicating the issue.
See the image of one example (it happens on all my views), in this particular example, the table has a header cell on top, then the following are dynamic cells. You can see in the image the hard black line (between tara and Clagary) that is the physical cutoff of the scrollability. i.e. touch above the line and autocomplete scrolls, touch below and whole table scrolls.
Second picture to further detail working and broken interface.
And this also happens in the dynamic cells, not just header. Here is the next example.