Harshit Goel
Harshit Goel

Reputation: 679

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 ?

Upvotes: 0

Views: 94

Answers (3)

Dheeraj D
Dheeraj D

Reputation: 4451

Do you want something like this:

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

You will get array of your image.

Upvotes: 1

Yogendra Girase
Yogendra Girase

Reputation: 631

You use this code

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

Upvotes: 3

nynohu
nynohu

Reputation: 1668

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?

Upvotes: 1

Related Questions