0

I've an UITableViewController within an UITableView(named: AutocompleteTableView) that appears only when i'm editing a textfield in the UITableViewController.

I draw UITableView(AutoCompleteTableView) looking for the coordinates for the second section of my UITableViewController.

I'm scrolling the UITableViewController to the second section with :

self.tableView.scrollToRowAtIndexPath(NSIndexPath(forRow: self.tableView.numberOfRowsInSection(1) - 1, inSection:
        1), atScrollPosition: UITableViewScrollPosition.Top, animated: true)

After scrolled the UITableViewController I draw the coordinates for the UITableView(AutoCompleteTableView) with :

autocompleteTableView.frame = CGRectMake(0, self.tableView.rectForSection(1).maxY, self.view.frame.width, (self.tableView.contentSize.height - self.tableView.rectForSection(1).maxY))

So, when I started writing in the textfield, the AutocompleteTableView appears in the correct position, but when I deleted a row from this section, the AutoCompleteTableView never again appears while I start to writing in the TextField.

I'm calling the two funcs (Scroll, and Draw) in the textfieldShouldChangeCaracter func.

  • Are you attempting to position a `UIViewController` (globally) based on the position a section in the parent `UITableViewController`? If so, isn't it a job for the `UIPresentationController`? – SwiftArchitect Feb 17 '16 at 01:34
  • Yes @SwiftArchitect you are right, but the thing is that the application is very complex because lot of vars so We thought the best way to help users to undertstand how they've to use the application is using the UITableView inside the UITableViewController. – Santiago Carmona González Feb 17 '16 at 12:07
  • Please further clarify: post images & code. The sentence *I've an UITableViewController within an UITableView* seems to indicate that you have 2 concurrent `UITableViewController`. Are you tying code to a specific `UITableViewCell`, which are transient? – SwiftArchitect Feb 17 '16 at 15:27
  • I found a solution, the problem was that when the row is deleted from the UITableViewController the AutoCompleteTableView isn't a subview from the UITableViewController, I addd this code after deleting the row and its works for my : `self.view.addSubview(autocompleteTableView)` – Santiago Carmona González Feb 17 '16 at 16:20

0 Answers0