So I am building an application for the iOS and i have got it to calculate a bunch of things and display them on the screen, on an -(IBAction)calculate.
it also builds an incrementing array that would be a cut list. there is a blank UITableView that runs down one side of the view. i have it after the viewDidLoad. now when i push the calculate button i would like to populate this list with the incrementing cutting list. I can’t find any tutorial or such to help me with this.
it only gives me errors when I put it in the calculate action.
so i have left it after the viewDidLoad and was hoping to populate it off the button touch.
Here is what I have:
// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [creeperArray count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
[cell.textLabel setText:[creeperArray objectAtIndex:indexPath.row]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
*/
}
Tell your table view to
reloadData. If its delegate and data source are set up right, andcreeperArraycontains the things you want displayed, it should work.(If not, you’ll need to provide more details.)