【发布时间】:2016-07-02 10:41:26
【问题描述】:
我有许多主要由 UITextViews 组成的 UITableViewCells。
现在的问题是当点击一个单元格时它不会启动-didSelectRowAtIndexPath:
这让我很难转投其他 VC。
我尝试了很多东西,其中之一是添加轻击手势识别器,然后尝试使用-presentViewController: 手动进行segue,我也遇到了一些问题。有没有更通用和简单的方法来做到这一点?我还需要将一些值传递给我将要展示的 viewController。
编辑
这就是我尝试使用手势的方法:
func tap(sender: UITapGestureRecognizer) {
let tapLocation = sender.locationInView(self.tableView)
let indexPath = self.tableView.indexPathForRowAtPoint(tapLocation)
let VC1 = self.storyboard!.instantiateViewControllerWithIdentifier("showPushID")
let navController = UINavigationController(rootViewController: VC1)
self.presentViewController(navController, animated:true, completion: nil)
在这里使用上面的这个方法是可行的,但我不能/不知道如何将参数传递给控制器上的一些变量。
这个方法:
let destinationVC = showPushNotificationMessage()
destinationVC.pushMessage = "test"
destinationVC.dateOpened = "test"
presentViewController(destinationVC, animated: true, completion: nil)
给我这个错误:
fatal error: unexpectedly found nil while unwrapping an Optional value
【问题讨论】:
-
请出示您的代码。
-
@UmairAfzal 更新
标签: ios iphone uitableview uitextview segue