I made a view controller with a
UISearchController
and a UITableView
. There are two different kind of search you can select from the search scope buttons : groups and people. Both searches work and show results on the table. However, if you click on each cell they should direct you to different dynamic pages (a dynamic group page or a dynamic person profile page). They both don't work. In fact, whenever I click on the cells the instead of presenting the view controller for the selected cell all that happens is that I get the following warning on the console :Warning: Attempt to present <MyProject.profileView: 0x13e9df000> on <MyProject.SearchPage: 0x142a1d8f0> which is already presenting <UISearchController: 0x142a1f7c0>
However, initially, before any character is typed, the tableView is populated with all the possible groups. Clicking on one of those cells works and corrently links you to the dynamic view controller for that group.
Here's the function that should link the cell to the different view controllers :
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if self.searchForGroups {
let detailCell:PFObject = self.filteredGroups.objectAtIndex(indexPath.row) as! PFObject
let vc = self.storyboard!.instantiateViewControllerWithIdentifier("DynamicCellView") as! DynamicCellView vc.GroupId = detailCell.objectId! self.presentViewController(vc, animated: false, completion: nil)
}else{
let user = self.peopleResults[indexPath.row]
let vc = self.storyboard!.instantiateViewControllerWithIdentifier("ProfileView") as! profileView
vc.profileId = user.objectId! self.presentViewController(vc, animated: true, completion: nil)
}
}
If you have any idea why this is happening it would be very appreciated if you could let me know. I've been stuck trying to figure this out for a while now!
Thanks