Ios UtableViewCell内的MKMapView崩溃
我对tableview单元格中的mapview有问题。加载视图时出现以下错误:Ios UtableViewCell内的MKMapView崩溃,ios,swift,uitableview,mkmapview,Ios,Swift,Uitableview,Mkmapview,我对tableview单元格中的mapview有问题。加载视图时出现以下错误: 2016-03-30 23:14:34.773 App[5006:303995] -[UITableViewCellContentView setDelegate:]: unrecognized selector sent to instance 0x7faad14920d0 2016-03-30 23:14:34.779 App[5006:303995] *** Terminating app due to unc
2016-03-30 23:14:34.773 App[5006:303995] -[UITableViewCellContentView setDelegate:]: unrecognized selector sent to instance 0x7faad14920d0
2016-03-30 23:14:34.779 App[5006:303995] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView setDelegate:]: unrecognized selector sent to instance 0x7faad14920d0'
这是UITableViewCell的代码:
import UIKit
import MapKit
class MapTableViewCell: UITableViewCell, MKMapViewDelegate {
@IBOutlet weak var mapView: MKMapView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
mapView.delegate = self
mapView.userInteractionEnabled = false
}
}
但是当我删除行mapView.delegate=self
时,应用程序没有崩溃。但那我就不能操纵地图了
我还尝试使用故事板设置委托,但收到了相同的错误消息,应用程序崩溃。看起来你的
mapView
插座连接到了错误的视图good catch@dan!谢谢!