У меня проблемы с добавлением словаря в nsmutabledictionary. Кто-нибудь может увидеть, что я делаю не так?
@interface viewMap : UIViewController<MKMapViewDelegate> {
NSMutableDictionary *onclickDic;
}
@property (nonatomic, retain) NSMutableDictionary *onclickDic;
@end
@implementation viewMap
@synthesize onclickDic;
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
NSString *pushLat = [NSString stringWithFormat:@"%f", [annotation coordinate].latitude];
NSString *pushLng = [NSString stringWithFormat:@"%f", [annotation coordinate].longitude];
NSDictionary *latlngDic = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:pushLat, pushLng, nil] forKeys:[NSArray arrayWithObjects:@"lat", @"lng", nil]];
NSDictionary *toPush = [NSDictionary dictionaryWithObject:latlngDic forKey:[NSString stringWithFormat:@"%i", i]];
NSLog(@"toPush is %@", toPush); // this one is correct and works
[self.onclickDic addEntriesFromDictionary:toPush];
NSLog(@"onclickDic is %@", onclickDic); // this one gives (null)
}
@end