Моя реализация tableView:didSelectRowAtIndexPath
не работает.
С другой стороны, реализация салфетки делает.
Я хочу представить другую страницу при нажатии на строку таблицы.tableView: didSelectRowAtIndexPath не работает
Это мой код:
func tableView(_ tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath) {
let tableCell: SearchTableViewCell = tableView.dequeueReusableCell(withIdentifier: "searchcell") as! SearchTableViewCell
if(self.searchstatus == "people")
{
if(useridarray.object(at: (indexPath as NSIndexPath).row) as! NSString != "null")
{
self.searchdelegate.otheruserid=useridarray.object(at: (indexPath as NSIndexPath).row) as! NSString;
let ProfilePageViewController = self.storyboard?.instantiateViewController(withIdentifier: "otherprofile")
self.present(ProfilePageViewController!, animated: false, completion: nil)
}
}
else
{
if(useridarray.object(at: (indexPath as NSIndexPath).row) as! NSString != "null")
{
let hashtag1=search.text!.replacingOccurrences(of: "#", with: "")
self.searchdelegate.hashtag="\(hashtag1)" as NSString!
self.searchdelegate.hashtag=searchdelegate.hashtag.trimmingCharacters(in: CharacterSet.whitespaces) as NSString!
self.searchdelegate.hashtag=searchdelegate.hashtag.replacingPercentEscapes(using: String.Encoding.utf8.rawValue) as NSString!
let hashtag = self.storyboard?.instantiateViewController(withIdentifier: "hashtag")
self.present(hashtag!, animated: false, completion: nil)
}
}
}
Заменить didSelectRowAtIndexPath и использовать didSelectRowAt (swift3.0) –