class goodsClassTableViewController: UITableViewController {
var row = 0
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
row = indexPath.row
var gdvc = goodsDetailViewController()
gdvc.row = row
var sb = UIStoryboard(name: "Main", bundle: nil)
var vc = sb.instantiateViewControllerWithIdentifier("goodsDetailViewController") as goodsDetailViewController
self.presentViewController(vc, animated: true, completion: nil)
}
class goodsDetailViewController: UIViewController{
var row = 0
@IBOutlet weak var detailText: UITextView!
@IBOutlet weak var detailImage: UIImageView!
@IBOutlet weak var nextText: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
detailText.text = "第(row)行"
}
}
row的值传不过去啊,是不是方式不对
要看文档~~~不要急
" XXX(row) XXXX"
==================
我错了
问题在这里
row = indexPath.row
var gdvc = goodsDetailViewController()
gdvc.row = row
var sb = UIStoryboard(name: "Main", bundle: nil)
var vc = sb.instantiateViewControllerWithIdentifier("goodsDetailViewController") as goodsDetailViewController
self.presentViewController(vc, animated: true, completion: nil)
vc 和 gdvc