ios - Split a single NSMutableArray into two so that I can set each in each of the section in UITableView -


i want use multiple sections feature uitableview. have single nsmutablearray consists of data in dictionary format. in dictionary there key has values '0' , '1'. want create 2 separate nsmutablearray out of can assign them accordingly in different sections.

for example :

if (indexpath.section==0) {  nsdictionary *data = [roomlist1 objectatindex:indexpath.row];  } else {  nsdictionary *data = [roomlist2 objectatindex:indexpath.row];  } 

assuming value in dictionary set like:

nsmutablearray *firstarray = [nsmutablearray new]; nsmutablearray *secondarray = [nsmutablearray new];  (nsdictionary *dictionary in yourarray) {         if ([dictionary objectforkey:@"yourvalue"] isequaltostring: @"0") {             [firstarray addobject:dictionary];         } else if ([dictionary objectforkey:@"yourvalue"]isequaltostring: @"1") {              [secondarray addobject:dictionary];         }     } 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -