0
私は迅速な開発者で新しく、ネットで長い時間を探しています。しかし、使用しないでください。これを達成する方法を教えてください。スウィフトテーブルピンを選択してテーブルビューの詳細を表示する方法
tableview Cellの詳細を表示するマップピンを選択するとしたいと思います。この2枚のフォト
このよう
は
写真1
詳細が表示されます、私はこのコードを実行しようが、それでも
var dictRow = [String:String]()
var dicRow = [String:[String:String]]()
func getAddPin(){
for index in arrTable{
let Annotation = MKPointAnnotation()
let bLatitude = index["Latitude"] as! Double
let bLongitude = index["Longitude"] as! Double
Annotation.coordinate = CLLocationCoordinate2DMake(bLatitude , bLongitude)
Annotation.title = index["Name"] as? String
//writeing detail which pins is already make in map view
//I try use Annotation for key when I select pin can get value
PinName = [Annotation.title!] //Name for key
dictRow["ClassType"] = index["ClassType"] as? String
dicRow[Annotation.title!] = dictRow //write to dict
dictRow["City"] = index["City"] as? String
dicRow[Annotation.title!] = dictRow
dictRow["Area"] = index["Area"] as? String
dicRow[Annotation.title!] = dictRow
dictRow["Address"] = index["Address"] as? String
dicRow[Annotation.title!] = dictRow
dictRow["TelArea"] = index["TelArea"] as? String
dicRow[Annotation.title!] = dictRow
dictRow["Tel"] = index["Tel"] as? String
dicRow[Annotation.title!] = dictRow
myMapView.addAnnotations([Annotat
}
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
Pintouch = true
tableView2.isHidden = false
print(Pintouch)
myMapView.frame = CGRect(x: 0, y: 215, width: DeviceWidth, height: DeviceHeight - 330)
self.tableView2.reloadData()
}
func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) {
Pintouch = false
tableView2.isHidden = true
myMapView.frame = CGRect(x: 0, y: 35, width: DeviceWidth, height: DeviceHeight - 150)
}
func tableView(_ tableView: UITableView,cellForRowAt indexPath: IndexPath)-> UITableViewCell {
if Pintouch == true {
cell = tableView2.dequeueReusableCell(withIdentifier: "MyCell", for: indexPath) as! ClintTableViewCell
MapPinName = PinName[indexPath.item]
dictRow = dicRow[MapPinName]!
cell.MyCellName.text = MapPinName
cell.MyCellCT.text = dictRow["ClassType"]
cell.MyCellCIty.text = dictRow["City"]
cell.MyCellArea.text = dictRow["Area"]
cell.MyCellAddress.text = dictRow["Address"]
cell.MyCellTelArea.text = dictRow["TelArea"]
cell.MyCellTelArea.text = cell.MyCellTelArea.text! + "-"
cell.MyCellTelNum.text = dictRow["Tel"]
}
私がいることをどのように行うことができますが動作しませんでした?何か案は?歓声メイト!
回答ありがとうございました!しかし、私はGoogle Map SKDを使用しませんでした...あなたはこの問題を解決する別の方法がありますか? – Jeff
mapView:(MKMapView *)mapView viewForAnnotation:(id)注釈 {}と - (void)mapView:(MKMapView *)mapViewアノテーションビュー:(MKAnnotationView)の代わりにMKmapデリゲートメソッドを使用できます。 *)ビューcalloutAccessoryControlTapped:(UIControl *)コントロール {} –
Ps: - swiftに変換する –