objective c - store value in array -


hi new in objective c. have 3 text field. have store value in 1 dictionary , dictionary in 1 array every time when clicked on button @ time every text field's value stored in dictionary , dictionary stored on next index of array.

so can 1 me code given below:

[fnamedict setvalue:textfield1.text forkey:@"first name"];  [fnamedict setvalue:textfield2.text forkey:@"last name"];  [fnamedict setvalue:textfield3.text forkey:@"roll number"];  [userinfoarray addobject:fnamedict];  nslog(@"%@",userinfoarray); 

nsmutablearray *arr=[[nsmutablearray alloc] init]; 

then create dictionary assign values per keys , save in array like

[arr adobject:fnamedict]; 

then can access arr according index.

make sure allocation should 1 array.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -