Friday 15 July 2011

objective c - iPhone programming cellForRowAtIndexPath not called even after delegate set -


I am trying to create and drag the populated UITableView through an array. I have created a UIViewController and have set UIViewController as my tableview rep. However, it seems that my cell-endindexapath method is not called when the tableview is made, so my table is never populated, what do I understand here? (All labels are initialized in that function, because I'm trying to create main menu using only one table, all entries will be fixed).

  // Apply loadView to create a visible hierarchy Programmically, without using a nibb - (zero) load view {prefTable = [[UITableView alloc] initWithFrame: CGRectMake (0 , 0, 320, 480) Style: UITableViewStylePlain]; [Prefibal Set Deliget: Self]; // NSIndexSet * tmpIndRange = [[NSIndexSet Alok] initWithIndexesInRange: NSMakeRange (0,1)]; // [insert prefTable symbol: tmpIndRange withRowAnimation: UITableViewRowAnimationNone]; // [tmpIndRange release]; LabelArray = [[NSMUTABELRAIL] Initvid Capacity: 10]; [Labeled add object: NSLoclyged string (@ "account id", @ "c_accidid")]; [Label Array Ad Object: NSLoclyged String (@ "Site ID", @ "Site_ID")]; [Labeled add object: NSLoclyged string (@ "station id", @ "station_id")]; [Labeled add object: NSLlighted string (@ "encryption key", @ "ANC_Key")]; [Labeled add object: NSLoclyged string (@ "encryption on", @ "ANCII")]; PlaceholderRay = [[NSMutableArray alloc] initWithCapacity: 10]; [Labeled add object: NSLlighted string (@ "Required", @ "Required")]; [Labeled add object: NSLlighted string (@ "Required", @ "Required")]; [Labeled add object: NSLlighted string (@ "Required", @ "Required")]; [Labeled add object: NSLlighted string (@ "Required", @ "Required")]; [Labeled add object: NSLlighted string (@ "Required", @ "Required")]; Self.view = prefTable; } - (BOOL) textFieldShouldReturn: (UITextField *) textField {NSInteger currenttag = textField.tag; NSLog (@ "% d", textField.tag); // account id = textField.text; // station id = textField.text; // siteId = textField.text; [TextField Resigns First Responder]; Yes come back } - (UITableViewCell *) TableView: (UITableView *) Table View CellForAindindpath: (NSIndexPath *) Index Path {Fixed NSString * CellIdentifier = @ "cell"; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == null) {cell = [[[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: CellIdentifier] autorelease]; } // Set up the cell ... [cell setAssetry type: UITableViewCellAccessoryNone]; [Cell.textLabel setText: [LabelOreOutIndexX: indexpath.ro]]; // ((TextInputTableCell *) cell) .textField.placeholder = [placeholderOreObjectIndex: indexPath.row]; Return cell; } - (NSInteger) numberOfSectionsInTableView: (UITableView *) tableview {return1; } - (NSInteger) Table view: (UITableView *) Table view numberoffrose injection: (NSInteger) section {return4; }  

In addition, would it be better if I assigned the menu item by using the data source? It seems that section headers can only be assigned using a data source. Thanks!

"post-text" itemprop = "text">

Table view: cellForRowAtIndexPath: is part of UITableView Datasource Protocol - is not UITableViewDelegate You will need to create your controller UITableView's data source:

  prefTable.dataSource = self;  

No comments:

Post a Comment