보기 컨트롤러에 segueing 문제가 있습니다. xib 테이블보기 셀이있는 테이블보기가 있습니다. 여기 내 코드가있다.다른보기 컨트롤러 테이블보기 셀 xib
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
setupTableView()
setupDataSource()
}
private func setupTableView() {
tableView.backgroundColor = UIColor.clearColor()
tableView.allowsSelection = false
tableView.separatorColor = UIColor.clearColor()
tableView.registerNib(UINib(nibName: "ExampleTableViewCell", bundle: nil), forCellReuseIdentifier: "cell")
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! ExampleTableViewCell
let list = pariwisata[indexPath.row]
cell.nameLabel.text = list.name
cell.typeLabel.text = list.type
let image = objects[indexPath.row]
cell.apply(image)
return cell
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("Row \(indexPath.row) selected")
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return tableView.bounds.width/1.4
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
updateLocation(true)
}
func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
updateLocation(false)
updateLocation(true)
}
func updateLocation(running: Bool) {
let mapView = self.view as! GMSMapView
let status = CLLocationManager.authorizationStatus()
if running {
if (CLAuthorizationStatus.AuthorizedWhenInUse == status) {
locationManager.startUpdatingLocation()
mapView.myLocationEnabled = true
mapView.settings.myLocationButton = true
}
} else {
locationManager.stopUpdatingLocation()
mapView.settings.myLocationButton = false
mapView.myLocationEnabled = false
}
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if segue.identifier == "showTop10Detail" {
if let indexPath = self.tableView.indexPathForSelectedRow {
let destinationController = segue.destinationViewController as! DetailViewController
destinationController.detpariwisata = pariwisata[indexPath.row]
}
}
프로젝트를 만들 때 오류가 발생하지 않지만 테이블보기는 탭할 수 없습니다. 내 테이블보기를 탭할 수는 있지만 아무 것도 인쇄하지 않습니다. 내가 놓친 게 무엇입니까? pls 내게 단서를 제공합니다. 감사!
에 당신이 당신의 코드에서'tableView.delegate = self'을해야합니까? – Tj3n
예, 있습니다. –
이상한 다음'didSelectRowAtIndexPath'가 발생해야합니다. 두 번 확인하고 중단 점을 설정하거나 다른보기가 셀 선택을 차단하는지 확인해야합니다. – Tj3n