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
Post a Comment