Take the 2-minute tour ×

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];
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

#pragma mark -
#pragma mark Table view delegate

    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 {
    // For example: self.myOutlet = nil;

- (void)dealloc {
    [super dealloc];


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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
add comment

Your Answer


