ios - All cells have same text label in uitableviewconroller -


i have following function:

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"statecell" forindexpath:indexpath];      nsstring *state = self.statearray[indexpath.row];     cell.textlabel.text = state;      return cell; } 

the state strings come nsarray:

self.statearray = [nsarray arraywithobjects:@"alabama", @"alaska", @"arizona", @"arkansas", @"california", @"colorado", @"connecticut", @"delaware", @"florida", @"georgia", @"hawaii", @"idaho", @"illinois", @"indiana", @"iowa", @"kansas", @"kentucky", @"louisiana", @"maine", @"maryland", @"massachusetts", @"michigan", @"minnesota", @"mississippi", @"missouri", @"montana", @"nebraska", @"nevada", @"new hampshire", @"new jersey", @"new mexico", @"new york", @"north carolina", @"north dakota", @"ohio", @"oklahoma", @"oregon", @"pennsylvania", @"rhode island", @"south carolina", @"south dakota", @"tennessee", @"texas", @"utah", @"vermont", @"virginia", @"washington", @"west virginia", @"wisconsin", @"wyoming", nil]; 

all text labels in uitableviewcontroller show "alabama".

what doing wrong?

i accidentally set section function this:

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {      return [self.statearray count]; } 

it should

return 1; 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -