AutoCompleteTextView in a UITableViewCell

6 posts, 1 answers
  1. Miguel
    Miguel avatar
    4 posts
    Member since:
    Apr 2016

    Posted 15 Apr 2016 Link to this post

    Is there any way to add an AutoCompleteTextView in a UITableViewCell in a way that when suggestions view is displayed is added on the top view stack (hidding other UITableViewCells of the table?

    Any sample app were I could start working with?

  2. Answer
    Sophi
    Admin
    Sophi avatar
    103 posts

    Posted 20 Apr 2016 Link to this post

    Hi Miguel,

    The suggestionView of the TKAutoCompleteTextView can be attached to any visual element in your view hierarchy not only to the autocomplete itself. For example you can attach it as a child to the cell itself or the whole tableview.
    You can consider applying this approach to your project.
    You should set the suggestionViewOutOfFrame and then set new frame and parent to the suggestionView. Consider the following snippet from the customization example.
      self.autocomplete.suggestionViewOutOfFrame = YES;
    _listView = (TKListView*)self.autocomplete.suggestionView;
         
        _listView.frame = CGRectMake(10, self.view.bounds.origin.y + 50, self.view.bounds.size.width - 20, self.view.bounds.size.height - (15 + self.autocomplete.bounds.size.height));
        _listView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight ;
        [_listView removeFromSuperview];
        [self.view addSubview:_listView];

    For guidance you can check out our sdk examples, here is link to our autocomplete customization example.
    If you have any further questions, do not hesitate to contact us.

    Regards,
    Sophi
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Ryan
    Ryan avatar
    32 posts
    Member since:
    Jun 2016

    Posted 11 Jan in reply to Sophi Link to this post

    I want to attach TKAutocompleteTextView's suggestionView to the UITableView cell but make it appear as if it is attached to the suggestionView, completely lined up with it as it is by default. How can I achieve this? I also want it to disappear when you scroll the table as is the default behavior (I currently have it attached to the autocomplete by default but it does not appear always since there is not a lot of room in the cell's content view for the suggestion view).
  4. Ryan
    Ryan avatar
    32 posts
    Member since:
    Jun 2016

    Posted 11 Jan in reply to Ryan Link to this post

    or rather placing it on top of the UITableView itself right below the autocomplete so it appears attached to it like default.
  5. Ryan
    Ryan avatar
    32 posts
    Member since:
    Jun 2016

    Posted 11 Jan in reply to Ryan Link to this post

    Ideally I would like it to just work out of the box without me having to move the suggestionView from being attached to the autocomplete control within the cell to being attached to the top most view. Any way to get that working so that it always shows? My best guess as to why it does not show sometimes and shows sometimes is that the table cell doesn't have enough space to show it or there is a bug with the telerik controls.
  6. Sophi
    Admin
    Sophi avatar
    103 posts

    Posted 16 Jan Link to this post

    Hello Ryan,

    It looks to me like the cell's height is not enough to show the suggestionView.
    If the cell has height less than the autocomplete field plus the suggestion view height, something will appears cut.
    In order to verify the scenario, could you please send us a sample project so we can examine it and suggest proper solution according to it.

    Looking forward to hearing from you.

    Regards,
    Sophi
    Telerik by Progress
    Want to build beautiful Android apps as well? Check out UI for Android which enables the same set of scenarios, allowing you to create the same great app experience on both iOS and Android.
Back to Top