【发布时间】:2015-08-01 11:32:22
【问题描述】:
我有MyTableViewCell 类和他们的.xib
在我的TableViewController 上想要单击单元格内的按钮,然后转到我的另一个UIViewController 、UITableViewDataSource、UITableViewDelegate
从这里
class OverviewViewController: UITableViewController
{
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.registerNib(UINib(nibName: "MyTableViewCell", bundle: nil), forCellReuseIdentifier: "MyTableViewCell")
}
到这里
class HistoryController: UIViewController , UITableViewDataSource, UITableViewDelegate{
@IBOutlet var MyTable: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
self.MyTable.registerNib(UINib(nibName: "HistoryTableViewCell", bundle: nil), forCellReuseIdentifier: "HistoryTableViewCell")
}
historyBtn in MyTableViewCell
我用那个
....
cell.historyBtn.tag = indexPath.row
cell.historyBtn.addTarget(self, action: "getHistoryList", forControlEvents: UIControlEvents.TouchUpInside)
....
我的 HistoryList 方法
func getHistoryList()
{
presentViewController(HistoryController(), animated: true, completion: nil)
}
但是当转到HistoryController 我得到这个错误:
在展开可选值时意外发现 nil
MyTableView 无
【问题讨论】:
-
你正在使用故事板?
-
我还没有看到那个库@ido07
-
你能给我任何关于开发像那个库这样的多页面的建议吗?
-
在该库中,给出了 swift 的一个示例项目。请检查一下。
-
您的问题解决了吗?
标签: ios swift segue tableviewcell