I have a json data to show some infos.. but i should generate "a file" to save these infos to my iPhone. Ideas?
- (void)showInfos {
NSMutableDictionary *infoDictionary = [[NSMutableDictionary alloc]init];
[infoDictionary setObject:self.totalDuration.text forKey:@"totalFrames"];
NSMutableArray *nodesArray = [[NSMutableArray alloc]init];
[nodesArray addObject:@{@"x":@(_zeroButton.frame.origin.x),@"y":@(_zeroButton.frame.origin.y),@"frame":self.zeroBtnLbl.text}];
[nodesArray addObject:@{@"x":@(_firstButton.frame.origin.x),@"y":@(_firstButton.frame.origin.y),@"frame":self.firstBtnLbl.text}];
[nodesArray addObject:@{@"x":@(_secondButton.frame.origin.x),@"y":@(_secondButton.frame.origin.y),@"frame":self.secondBtnLbl.text}];
[nodesArray addObject:@{@"x":@(_thirdButton.frame.origin.x),@"y":@(_thirdButton.frame.origin.y),@"frame":self.thirdBtnLbl.text}];
[nodesArray addObject:@{@"x":@(_fourthButton.frame.origin.x),@"y":@(_fourthButton.frame.origin.y),@"frame":self.fourthBtnLbl.text}];
[infoDictionary setObject:nodesArray forKey:@"nodes"];
NSLog(@"dicArray:%@",infoDictionary);
NSData *data = [NSJSONSerialization dataWithJSONObject:infoDictionary options:kNilOptions error:nil];
NSArray *retDicArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
NSLog(@"retDicArray:%@",retDicArray);
}
Aucun commentaire:
Enregistrer un commentaire