如何重新加载弹出窗口中显示的表格视图

发布于 2024-12-03 07:24:17 字数 503 浏览 4 评论 0原文

我正在处理一个让我发疯的问题。我对 IPaD 编程很陌生(实际上我对 Objective C 很陌生)。

所以我的问题可能看起来很愚蠢,但无论如何。

我有一个包含 UITextField 的视图。选择此字段后,将显示一个包含 ListView 的弹出窗口,以便为用户提供一些搜索建议来帮助用户。我的问题是,当修改 textfield.text 时,我希望 listView 过滤其内容以仅保留以 textField.text 开头的字段。

当我尝试调用方法 reloadData 时,它似乎没有到达方法主体并且什么也不执行。 这是我尝试这样做的方法

UITableViewController *controller = (UITableViewController *)
[self.resultsPopoverController contentViewController];
[controller.tableView reloadData];

这种方法有什么问题吗?

I'm dealing with an issue that's driving me crazy. I'm quite new in programming for IPaD (as much as i'm new to Objective C actually).

So my question may seem stupid but whatever.

I have a view containing a UITextField. When this field is selected, a popover containing a ListView is displayed in order to help the user by giving him a few suggestions for his search. My issue is that when the textfield.text is modified, i'd like the listView to filter its content to keep only the fields that begins like the textField.text.

When i try to call the method reloadData, it seems that it doesn't reach the method body and it does nothing.
Here's how i attempted to do it

UITableViewController *controller = (UITableViewController *)
[self.resultsPopoverController contentViewController];
[controller.tableView reloadData];

What's wrong with this way of doing it?

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

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

发布评论

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

评论(1

时光无声 2024-12-10 07:24:17

在控制器的 viewWillAppear 方法中,重新加载 tableview 的数据,应该没问题。

inside your controller's viewWillAppear method, reload the the tableview's data and it should be fine.

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