Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mvkoe

macrumors regular
Original poster
Aug 4, 2008
103
3
Belgium
Hey

Last year when I was trying to code in xCode for my iPhone I remembered that when I'm using an TableView that xCode would auto generate some code for me for the rows/sections etc.

I've added the implements of datasource etc to my file, but still it wouldn't generate. What am I doing wrong and how can I get those auto generated code back.

Edit:

I'm talking about this code:
Code:
#pragma mark -
#pragma mark Table Data Source Methods
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section { return[list count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *DeleteMeCellIdentifier = @"DeleteMeCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: DeleteMeCellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DeleteMeCellIdentifier];
}
NSInteger row = [indexPath row];
cell.textLabel.text = [self.list objectAtIndex:row]; return cell;
}

Grz
 
Last edited:
That code is "generated" (really, it's just a template) when you select "File -> New File -> Objective C Class" and set "Subclass of" to UITableViewController
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.