0
我面临一个问题,即将NSMutableArray
转换为NSData
和存储&检索到该数组到rootviewcontroller
所以请给我想法。这里是我正在使用的代码:iPhone:转换NSMutableArray NSData与存储和检索问题
appDelegate = (FindNearMeAppDelegate *)[[UIApplication sharedApplication]delegate];
appDelegate.isCategoryCell = TRUE;
appDelegate.isButton = NO;
NSString *categoryStr = categoryName.text;
NSLog(@"Category Name:--->%@",categoryStr);
appDelegate.categoryData = [NSMutableDictionary dictionaryWithObjectsAndKeys:
categoryStr, @"name",image ,@"image", nil];
[appDelegate.categories addObject:appDelegate.categoryData];
NSLog(@"Category Data:--->%@",appDelegate.categories);
我初始化的NSMutableArray(appDelegate.categories)和的appdelegate的NSMutableDictionary。
在此先感谢。
如果数据是纯粹的数组/词典数据,只字符串和数字,将其转换成JSON和储存JSON。 –
@DanielRHicks名称和形象是从uiimagepickercontroller所以任何想法? –
你可以通过'NSData * data = UIImagePNGRepresentation(aImage);'将'UIImage'转换成'NSData'。希望有助于! – msgambel