H
Heinzi1991
Registriert
Thread Starter
- Dabei seit
- 28.09.2014
- Beiträge
- 3
- Reaktionspunkte
- 0
Hallo liebes Forum,
ich hab ein Problem mit meiner App und hoffe ihr könnt mir dabei helfen. Also ich habe eine plist (array) und in diesem Array sind dictionaries drinnen. Mit einer fast enumination teile ich alle Sachen auf siehe Code:
Diese Punkte werden dann auf der Map angezeigt und wenn man den Pin anklickt, habe ich rechts ein Info Button. Mir ist es noch gelungen, wenn man den Button drückt das ein neuer ViewController angezeigt wird. Nun möchte ich aber, das der Titel des ViewControllers und ein Label den gleichen Titel haben, wie der Titel des Pin und da scheitere ich zurzeit.
Hoffe mir kann jemand helfen und wenn ihr noch was braucht einfach sagen.
ich hab ein Problem mit meiner App und hoffe ihr könnt mir dabei helfen. Also ich habe eine plist (array) und in diesem Array sind dictionaries drinnen. Mit einer fast enumination teile ich alle Sachen auf siehe Code:
Code:
[FONT=Menlo]-([COLOR=#703daa]NSMutableArray[/COLOR] *)createAnnotations[/FONT]
[FONT=Menlo]{[/FONT]
[COLOR=#703DAA][FONT=Menlo]NSMutableArray[COLOR=#000000] *annotations = [[/COLOR]NSMutableArray[COLOR=#3d1d81]new[/COLOR][COLOR=#000000]];[/COLOR][/FONT][/COLOR]
[COLOR=#008400][FONT=Menlo]//Read location details from plist[/FONT][/COLOR]
[COLOR=#3D1D81][FONT=Menlo][COLOR=#703daa]NSString[/COLOR][COLOR=#000000] *path = [[[/COLOR][COLOR=#703daa]NSBundle[/COLOR]mainBundle[COLOR=#000000]] [/COLOR]pathForResource[COLOR=#000000]:[/COLOR][COLOR=#d12f1b]@"skatepark"[/COLOR]ofType[COLOR=#000000]:[/COLOR][COLOR=#d12f1b]@"plist"[/COLOR][COLOR=#000000]];[/COLOR][/FONT][/COLOR]
[FONT=Menlo] [COLOR=#703daa]NSArray[/COLOR] *locations = [[COLOR=#703daa]NSArray[/COLOR] [COLOR=#3d1d81]arrayWithContentsOfFile[/COLOR]:path];[/FONT]
[FONT=Menlo] [COLOR=#bb2ca2]for[/COLOR] ([COLOR=#703daa]NSDictionary[/COLOR] *row [COLOR=#bb2ca2]in[/COLOR] locations)[/FONT]
[FONT=Menlo] {[/FONT]
[FONT=Menlo] [COLOR=#703daa]NSNumber[/COLOR] *latitude = [row [COLOR=#3d1d81]objectForKey[/COLOR]:[COLOR=#d12f1b]@"latitude"[/COLOR]];[/FONT]
[FONT=Menlo] [COLOR=#703daa]NSNumber[/COLOR] *longitude = [row [COLOR=#3d1d81]objectForKey[/COLOR]:[COLOR=#d12f1b]@"longitude"[/COLOR]];[/FONT]
[FONT=Menlo] [COLOR=#703daa]NSString[/COLOR] *title = [row [COLOR=#3d1d81]objectForKey[/COLOR]:[COLOR=#d12f1b]@"title"[/COLOR]];[/FONT]
[COLOR=#008400][FONT=Menlo]//Create coordinates from the latitude and longitude values[/FONT][/COLOR]
[COLOR=#703DAA][FONT=Menlo]CLLocationCoordinate2D[COLOR=#000000] coord;[/COLOR][/FONT][/COLOR]
[FONT=Menlo] coord.[COLOR=#703daa]latitude[/COLOR] = latitude.[COLOR=#703daa]doubleValue[/COLOR];[/FONT]
[FONT=Menlo] coord.[COLOR=#703daa]longitude[/COLOR] = longitude.[COLOR=#703daa]doubleValue[/COLOR];[/FONT]
[FONT=Menlo] [COLOR=#4f8187]MapViewAnnotation[/COLOR] *annotation = [[[COLOR=#4f8187]MapViewAnnotation[/COLOR] [COLOR=#3d1d81]alloc[/COLOR]] [COLOR=#31595d]initWithTitle[/COLOR]:title [COLOR=#31595d]AndCoordinate[/COLOR]:coord];[/FONT]
[FONT=Menlo] [annotations [COLOR=#3d1d81]addObject[/COLOR]:annotation];[/FONT]
[FONT=Menlo] }
return annotations;
}[/FONT]
Diese Punkte werden dann auf der Map angezeigt und wenn man den Pin anklickt, habe ich rechts ein Info Button. Mir ist es noch gelungen, wenn man den Button drückt das ein neuer ViewController angezeigt wird. Nun möchte ich aber, das der Titel des ViewControllers und ein Label den gleichen Titel haben, wie der Titel des Pin und da scheitere ich zurzeit.
Hoffe mir kann jemand helfen und wenn ihr noch was braucht einfach sagen.