【发布时间】:2015-07-31 03:36:03
【问题描述】:
我想在didSelectRowAtIndexPath 上显示下一个 ViewController,并且发生如下。
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var section = indexPath.section
var row = indexPath.row
var cell:UITableViewCell = self.tblView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell
cell.textLabel?.text = "hello"
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
frequentVC = storyboard.instantiateViewControllerWithIdentifier("frequentVC") as? DropOffFrequentVC
self.presentViewController(frequentVC!, animated: true,completion: nil)
}
nextViewController 出现,我将 UIViewController 解散为 self.dismissViewControllerAnimated(true, completion:nil) 并再次调用以前的 UIViewController 但现在当我等待一段时间并再次尝试呈现 UIViewController 时,UIViewController 的调用速度非常慢但是didSelectRowAtIndexPath 会立即被调用。在等待期间,如果我在任何地方点击 aroundView,则会立即呈现UIViewController。此外,如果我点击两次UIViewController,则会立即呈现。
项目如下: https://drive.google.com/open?id=0B6dTvD1JbkgBN0J3SkFOTDJtZlU&authuser=0
【问题讨论】:
-
在
viewDidLoad中初始化viewcontroller并将其存储为实例变量是否有帮助? -
不......还是一样......
-
我已经上传了项目...请看一下
标签: ios objective-c uitableview swift uistoryboard