// Number of rows in the partition-(nsinteger) tableview :( uitableview *) tableview numberofrowsinsection :( nsinteger) Section {return [self. listdata count];} // Add information for each row-(uitableviewcell *) tableview :( uitableview *) tableview cellforrowatindexpath :( nsindexpath *) indexpath {static nsstring * tag = @ "tag ";
// Myclass is a self-implemented uitableviewcell, which contains a label and a button.
Myclass * cell = (myclass *) [tableview dequeuereusablecellwithidentifier: Tag]; If (cell = nil) {[[nsbundle mainbundle] loadnibnamed: @ "empty" Owner: Self options: nil]; // cell = [[[myclass alloc] initwithframe: cgrectzero // reuseidentifier: Tag] autorelease]; cell = cellclass;} nsuinteger ROW = [indexpath row]; // cell. textlabel. TEXT = [listdata objectatindex: Row]; cardType * Ct = (cardType *) [self. listdata objectatindex: Row]; cell. infolabel. TEXT = CT. cardType; // when setting text for a button, the button status must be set at the same time; otherwise, the [cell. button settitle: CT. cardid forstate: uicontrolstatenormal]; return cell ;}