【问题标题】:Insert into UITableView with animation?插入带有动画的 UITableView?
【发布时间】:2011-08-02 06:02:02
【问题描述】:

我有一个视图,我想在其中显示 UITableView 并制作动画以添加行。在我的 .m 中,我将它设置为带有 UITableView 子类的 UIViewController。我将我的数据源和委托与我的文件所有者联系起来。

因为当试图调用这样的东西不起作用时:[self.tableView reloadData]',我创建了一个 UITableView IBOutlet 来执行此操作 - theTableView

当尝试调用添加对象时:

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];

它启动,但调用 viewDidLoad 时没有任何反应。我无法将其设为 UITableViewController,因为其中还有许多其他项目。

对不起,如果我的术语听起来有点不对劲 - 我不擅长这个。任何帮助表示赞赏!

库尔顿

【问题讨论】:

  • 如何将 UITableView 添加到视图中?
  • 我用 NSMutableArray 填充它。

标签: objective-c xcode ios4 uiviewcontroller uitableview


【解决方案1】:

我猜你在 Interface Builder 中与 UITableView 插座的连接断开了。

【讨论】:

  • 你正在合成属性并调用 self.theTableView 对吗?
猜你喜欢
  • 1970-01-01
  • 2012-12-04
  • 2013-01-12
  • 2012-06-14
  • 2012-01-06
  • 2016-08-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多