gpt4 book ai didi

ios - TableView :didSelectRowAtIndexPath fails

转载 作者:行者123 更新时间:2023-11-28 21:19:07 25 4
gpt4 key购买 nike

我对 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)
}

}

}

enter image description here

最佳答案

使用swift3.0的方法

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}

关于ios - TableView :didSelectRowAtIndexPath fails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40543100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com