Tableview重新加载数据问题iphone sdk

发布于 2024-09-06 01:15:26 字数 393 浏览 4 评论 0原文

我有一个类 A,它是 uitableviewcontroller 的子类,还有一个类 B,它实际上显示我的 tableview 及其内容,它是 A 的子类。

有一个 xml 解析器,它解析我的 xml 并将内容存储在应用程序委托的 nsmutablearray 中。现在,我将此委托数组提取到类 B 中的本地 nsmutablearray 中,以最大程度地减少两个类(即委托和类 B)之间的通信并显示该通信。

在 A 类中满足特定条件后,我将调用 xml 解析器来重新填充委托数组,并调用 B 类的 tableview 重新加载方法。问题是当我调用tableview的重新加载数据时,类B的委托方法被调用。但在此之前,我需要在 B 类的本地数组中获取这个委托数组。我该怎么做呢?

有人可以帮忙吗?

提前致谢。

I have a class A which is a subclass of uitableviewcontroller and one more class B which actually displays my tableview with its content is a subclass of A.

There's an xml parser which parses my xml and stores the content in an nsmutablearray of application delegate. Now, I fetch this delegate array into a local nsmutablearray in class B to minimise the communication between the two classes i.e. delegate and class B and display that.

After certain condition is met in class A, I'm calling xml parser to refill the delegate array and I'm calling class B's tableview reload method. The problem is when I call the tableview's reload data, class B's delegate methods are called. But before that I need to grab this delegate array in local array in class B. How shall I do that?

Can anybody please help?

Thanx in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素手挽清风 2024-09-13 01:15:26

建议您在 xmlParser 更新数组时发布通知。对象 B(B 类的实例)可以注册通知。收到通知后,对象 B 可以在 B 类的实现中调用 [[self tableView] reloadData] 之前重新加载数组。

Suggest that you post a notification from your xmlParser when it has updated the array. Object B (instance of Class B) can register for the notification. Upon receiving the notification Object B can reload the array before calling [[self tableView] reloadData] in the implementation of Class B.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文