Auto Generated code

Discussion in 'iOS Programming' started by Mvkoe, Nov 30, 2012.

  1. Mvkoe, Nov 30, 2012
    Last edited: Nov 30, 2012

    Mvkoe macrumors member

    Mvkoe

    Joined:
    Aug 4, 2008
    Location:
    Belgium
    #1
    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
     
  2. Reason077 macrumors 68000

    Reason077

    Joined:
    Aug 14, 2007
    #2
    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
     

Share This Page