简体   繁体   中英

Objective C-Adding data from a Key Value of Dictionary in an Array

how to store[ rcImage = "1475004450741343.jpg,1475004451955166.jpg" ] to an array from a dic.

    {
        id = 24;
        rcImage = "1475004450741343.jpg,1475004451955166.jpg";
        registrationNumber = RJ01;
        registrationdate = "2015-09-28 00:00:00.0";
        regno = RJ01;
    }

these are my codes.

NSMutableArray *imageArray=[[NSMutableArray alloc]init];
            imageArray=[paramData objectForKey:@"imageRC"];
            NSLog(@"%@",imageArray);

Please help ?

You use this code

NSMutableArray *imageArray = [[NSMutableArray alloc]init];
NSString *imageString = [paramData objectForKey:@"rcImage"];
NSLog(@"--%@",imageString);
imageArray = [imageString componentsSeparatedByString:@","];
NSLog(@"--%@",imageArray);

Ok, if you only want to convert your rcImage to array, here is all you need. How can I convert the NSString to a array?

Do you want something like this:

NSString *strImageArray = [paramData objectForKey:@"rcImage"];
NSArray *arrImages = [strImageArray componentsSeperatedByString:@","];

You will get array of your image.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM