3

How can a UITableView be navigated with arrow keys (physical keyboard) much like the spotlight behavior that was introduced in iOS 10?

Looking to have a user type into a search box and use the up/down arrow to highlight a row in a tableview and press return key to select the row.

I have not found any resources on the topic.

Please provide sample code in Swift.

Michael Voccola
  • 1,827
  • 6
  • 20
  • 46

1 Answers1

1

Did not try it, but this could be the answer for you.

  self.tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: .Top, animated: true)

and use the text field delegate to handle return.

Edit: For highlighting use

tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!

and update your cell visual

Luzo
  • 1,336
  • 10
  • 15