It would be much easier to use IB to create your UITableView and populate the array. You can start populating the NSArray in the - (void)viewDidLoad method. Don't forget to add the array in the .h header file.
Code:
- (void)viewDidLoad {
myArray = [[NSArray alloc] initWithObjects:@"1", @"2", @"3", nil];
[super viewDidLoad];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
// Set up the cell...
cell.text = [myArray objectAtIndex:indexPath.row];
return cell;
}