iphone - how to copy a NSDictionary with keyvalues -
i have method returning values in parameters. these values nsdictionaries have keyvalues.
i know how make copy of these nsdictionaries include keyvalues.
currently trying do.
//.h
nsmutabledictionary *tempdic; @property (strong, nonatomic) nsdictionary *tempdic;
//.m
@synthesize tempdic; - (void)recivermethod:(nsdictionary *)mydictionary { // method specific variable **mydictionary** , copy global dictionary value tempdic tempdic = [mydictionary mutablecopy]; // dosnt work }
the thing behing mydictionary might have several keyvalues can access using
mydictionary.firstvalue mydictionary.secondvalue mydictionary.thirdvalue
but when try use tempdic none of keys avalible..
i.e. tempdic.firstvalue tempdic.secondvalue tempdic.thirdvalue
dosnt work...
any appreciated.
1) remove this, nsmutabledictionary *tempdic;
having enough,
@property (strong, nonatomic) nsdictionary *tempdic;
since tempdic object strong, nonatomic
- (void)recivermethod:(nsdictionary)mydictionary { self.tempdic = mydictionary; }
edit 1:
id value1 = [self.tempdic objectforkey:@"firstvalue"]; id value2 = [self.tempdic objectforkey:@"secondvalue"]; id value3 = [self.tempdic objectforkey:@"thirdvalue"];
Comments
Post a Comment