Reputation: 67
I am developing a Tab Bar Application in which My need like
I Have a table view in which I have 9 rows (name of acct Groups) which are in one array. When I select any row it opens another view and I enter AcctTitle
and save it. When I click On another tab it opens a table view and It should display rows according to acct group.
I mean that when I select xxx group in previous tab and enter 5 acct Title one by one and save it, in other tab it should display xxx group as a header of section and 5 titles as row in that section.
Different groups have different rows (two different tab). How can I do that?
Upvotes: 2
Views: 171
Reputation: 4022
Define an array with list of sections u need to display. and in
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return [urSectionlistArray count]}
and in the method
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ return [urSectionlistArray objectAtIndex:section]count];
define the no of rows based on the different sections defined.
U can define the title of the headers in the method
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return [urSectionlistArray objectAtIndex:section];
}
U can try the above approach..
Upvotes: 0
Reputation: 750
You just use the section value change they all are in different different group use these method.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
if(section==0)
{
//what ever you want
}
if(section==1)
{
//what ever you want
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if(section==0)
{
//what ever you want
}
if(section==1)
{
//what ever you want
}
}
Upvotes: 0
Reputation: 8997
Use this two methods
//For Number of section
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
//For Number of Cell
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
Upvotes: 1
Reputation: 821
Try out:
-(void)viewDidAppear:(BOOL)animated
{
[tableview reloadData]
}
Hope this helps.
Upvotes: 0