Adding data to 2 Sections of UITableView from SINGLE nsmutablearray?

Yeah it is possible to do it You can have a single NSMutableArray ( resultArray ) with the entire content in it Then in the cellForRowAtIndexPath method you can do it this way (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if(indexPath. Section == 0) { cell. Text=**resultArray objectAtIndex:indexPath.

Row**; } else if(indexPath. Section == 1) { cell. Text=**resultArray objectAtIndex:(indexPath.

Row+5)**; } else if(indexPath. Section == 2) { cell. Text=**resultArray objectAtIndex:(indexPath.

Row+11)**; } } and in numberOfRowsInSection (NSInteger)tableView:(UITableView *)tableView1 numberOfRowsInSection:(NSInteger)section { NSInteger count; if(section == 0) { count=6; } else if(section == 1) { count=6; } else if(section == 2) { count=4; } return count; }.

Yeah it is possible to do it. You can have a single NSMutableArray (resultArray) with the entire content in it. Then in the cellForRowAtIndexPath method you can do it this way - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if(indexPath.

Section == 0) { cell. Text=**resultArray objectAtIndex:indexPath. Row**; } else if(indexPath.

Section == 1) { cell. Text=**resultArray objectAtIndex:(indexPath. Row+5)**; } else if(indexPath.

Section == 2) { cell. Text=**resultArray objectAtIndex:(indexPath. Row+11)**; } } and in numberOfRowsInSection - (NSInteger)tableView:(UITableView *)tableView1 numberOfRowsInSection:(NSInteger)section { NSInteger count; if(section == 0) { count=6; } else if(section == 1) { count=6; } else if(section == 2) { count=4; } return count; }.

I wanted to know how to list data in tableView in different sections BUT from a single datasource. All examples I saw had number of arrays = number of sections. What I want is suppose I have a 3d nsmutableArray.

Its probably dooable, but I jus need a direction.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions