我试图修改我分叉的https://github.com/vinnytwice/BicycleSpeed这个存储库 但没有使用tableviews,因为我有兴趣在更加图形设计的InfoSpeedoViewController中显示速度节奏和距离等数据。 我还没有管理tableviews控制器,所以我无法理解如何以及在何处修改项目。 任何人都可以帮我指出正确的方向吗? 我的版本只有两个ViewControllers: 带有ScanButton和SpeedoViewController的MainViewController
到目前为止,我删除了InfoTableViewController.swift,它只是绘制了tableview。但我根据自己的需要坚持修改MainViewController。我不理解覆盖函数prepare(for segue)部分代码。它使用第一个if语句将数据传递给InfoTableViewController,因此我不需要它,但是使用第二个if语句启动扫描函数bluetoothManager.startScan()并通过它的UINAvigationController将数据传递给ScanViewcontroller而不是ScanViewController中的tableView。我对吗? 如果是这样,我可以调用扫描函数并将数据传递给我的SpeedoViewController吗?
@IBAction func scanButton(_ sender: UIBarButtonItem) {
bluetoothManager.startscan()
performSegue(withIdentifier identifier: MainToSpeedoSegue, sender: self)
}
我猜不知道与scanViewController的关系。数据是否仍然以infoTableView结尾? 感谢
答案 0 :(得分:0)
终于找到了解决方案。它是为一个普通的ViewController更改tableViewController,它具有显示值的标签。将tableViewController中的引用更改为ViewController,并将返回的值链接到接收持续更新值的函数内的标签。 一旦解码了数据流就很容易了。