iosfreak
iosfreak

Reputation: 5238

Insert into UITableView with animation?

I have a View that I want to display a UITableView in and animate to add rows. In my .m, I have it set as a UIViewController with the UITableView subclasses. I have my dataSource and delegate linked up with my File's owner.

Since when trying to call something like this won't work: [self.tableView reloadData]', I created a UITableView IBOutlet to do this - theTableView.

When trying to call to add objects like this:

NSArray *insertIndexPaths = [[NSArray alloc] initWithObjects:
                             [NSIndexPath indexPathForRow:0 inSection:0],
                             [NSIndexPath indexPathForRow:1 inSection:0],
                             [NSIndexPath indexPathForRow:2 inSection:0],
                             nil];
[theTableView beginUpdates];
[theTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[theTableView endUpdates];

It launches, but nothing happens when the viewDidLoad was called. I can't make it a UITableViewController because I have many other items in there.

Sorry if my lingo sounds a bit off - I'm a noobie at this. Any help is appreciated!

Coulton

Upvotes: 1

Views: 1464

Answers (1)

Mark Adams
Mark Adams

Reputation: 30846

I'm guessing that you have a broken connection to your UITableView outlet in Interface Builder.

Upvotes: 2

Related Questions