I have an Iphone application in which i am trying to load the two arrays in to the same table.for that i combined two arrays and make another array.and load it from that array.that is working fine.My problem i need to make different cell images for these two array items.and also the detail text label is defferent for `
NSMutableArray *dataArray=[[NSMutableArray alloc] init];
NSMutableArray *dataArray1=[[NSMutableArray alloc] init];
NSDictionary *news=[dict objectForKey:@"news"];
NSDictionary *deals=[dict objectForKey:@"deals"];
NSLog(@"%@",[news classForCoder]);
NSLog(@"%@",news);
for(NSDictionary *key in news)
{
if([key isKindOfClass:[NSDictionary class]])
{
[dataArray addObject:key];
}
}
for(NSDictionary *key in deals)
{
if([key isKindOfClass:[NSDictionary class]])
{
[dataArray1 addObject:key];
}
}
self.newsarray = [[dataArray arrayByAddingObjectsFromArray:dataArray1] mutableCopy];
//self.newssarray=dataArray;
[self.mTableView reloadData];
` i need to change the cell image for the array elements from the two arrays.if the element is from first then the cell image is this else the other?can anybody show me the code snippet to achieve that?
I would make a property and set its value to
[dataArray count].In
cellForRowAtIndexPathjust do something like the following:You will have to reset
dataArraySizeanytime you update your data source if the size changes.Alternatively, you don’t even really need to create a new combined array if you just want to display the data.