iPhone TableView Data Into 2 Sections
Posted
by
MrPink
on Stack Overflow
See other posts from Stack Overflow
or by MrPink
Published on 2011-03-18T11:37:23Z
Indexed on
2011/03/20
0:09 UTC
Read the original article
Hit count: 271
Hello,
I am trying to get a tableview to split data i have in an array into sections...
I'm pretty new to this but below is my code snippet
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if(section == 0) {
contentArray = [[NSArray arrayWithObjects:@"Send SMS", @"Reports", nil] retain];
}
if(section == 1) {
contentArray = [[NSArray arrayWithObjects:@"Accounts", nil] retain];
}
return [contentArray count];
}
I have split the data successfully into the 2 sections but when populating the rows It just repeats the first content array in both sections.
Can any one help...
Thanks
© Stack Overflow or respective owner