开发者

can't update text fields in a UIViewController that pushed onto a UINavigation Controller

I have a UINavigationController that gets UIViewControllers pushed onto it. In the first view there is a grouped table view which has 3 rows, each containing a UITex开发者_运维技巧tField with initial text set on viewWillLoad of that view controller. Tapping any one of the table view cells pushes the 2nd UIViewController onto the nav controller's stack. Each of the secondary view controllers has another table view where the user can select a choice by touching one of the rows.

The experience is identical to the iPhone's ical, when selecting "repeat" for an event.

The problem is that when the user touches the UIBarButtonItem to save, and I set the selected value into the previous views text field, the text field doesn't update. Regardles of what text I set it doesn't update when the navigation controller pops back to the first view. Could it be cached, or the view cached as a whole?

I'm logging all the values and everything looks correct.

Sorry to not post any code, I'm not sure how to without posting a book.


You could do a reloadData when the main view reappears. This forces the table to refetch the visible rows and redraw them.

[theTable reloadData];

Edit: an improvement would be to only reload the row affected, instead of reloading all the visible rows with the reloadRowsAtIndexPaths:withRowAnimation: method.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜