Ich entwickle eine App mit Swift-2. Ich analysiere JSON-Daten zur Tabellenansicht. Wenn Sie auf eine Zelle tippen, wird sie zu einem anderen View-Controller verschoben und Daten werden abgerufen. Alles funktioniert gut, aber das Problem ist, wenn ich nicht weiß, wie man den Breiten- und Längengrad von JSON-Daten parst, die vom Server kommen.Wie json Breite und Länge über Zelle in Swift analysieren
-Code in meinem ersten Controller:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
TableView.deselectRowAtIndexPath(indexPath, animated: true)
let tripcontroller = self.storyboard?.instantiateViewControllerWithIdentifier("UpcomingController") as! UpcomingController
let strbookdetail : NSString=arrDict[indexPath.row] .valueForKey("customer_name") as! NSString
let strdrop : NSString=arrDict[indexPath.row] .valueForKey("customer_phno") as! NSString
tripcontroller.dataFromBeforeVC = ["strbookdetail":strbookdetail as String, "strdrop":strdrop as String]
navigationController?.pushViewController(tripcontroller, animated: true)}
//it helps when tapping the cell moves to other controller and fetching data
Code in zweitem Controller:
//here i wrote some functions and methods for updating current location and fetching some data when tapped a cell
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
//i know that here only i need to parse json lat and long so HELP me to parse
Daten vom Server:
{item:[{
picklat:"9.322334",
picklong:"78.24524",
droplat:"9.253634",
droplong:"78.56245"
},{
picklat:"8.245234",
picklong:"67.456434",
droplat:"8.4567865",
groplong:"67.465785"
}]}
aus diesen JSON-Daten i zeigen will Annotation mit pick and drop
versuchen diese item.objectAtIndex (Index) .objectForKey (piclat) wie? NSNummer –
ich werde es überprüfen und antworten danke für Ihre Antwort –