开发者

Insert into UITableView with animation?

开发者 https://www.devze.com 2023-02-23 01:29 出处:网络
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 u

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 - theTableVie开发者_Python百科w.

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消