1

Okay, I am trying to add a row to my tableview. I must be doing somthing wrong. I am adding to the array, is there a function that I am missing to refresh the UITableView using the new array?

#import "RootViewController.h"
#import "DetailViewController.h"
@implementation RootViewController
@synthesize toolbar;
@synthesize window;

#pragma mark -
#pragma mark View lifecycle


- (void)viewDidLoad {
    //theArray = [[NSArray alloc] initWithObjects:@"Apple",nil];
    theArray = [[NSMutableArray alloc] init];


    [super viewDidLoad];

    [window addSubview:[navigationController view]];
    [window addSubview:toolbar];
    [window makeKeyAndVisible];
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}



#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *selectedTask = [theArray objectAtIndex:indexPath.row];
    DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
    dvController.selectedTask = selectedTask;
    [self.navigationController pushViewController:dvController animated:YES];
    [dvController release];
    dvController = nil;

}



- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Relinquish ownership any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
    // For example: self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end

Your help is greatly appreciated as I have looked around the site and have seen something about pushing array to tableview but further research lead me into a wiled goose chase.

1 Answer 1

3

Assuming that you have all of your UITableViewDataSource methods correctly defined, you probably just need to call reloadData on your UITableView. See the UITableView reference for details about the reloadData method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.