The UIToolBar has two views, a UIView w/UITextViews and a UIView w/UITableView.
The UITableView that gets called via a UIToolBar. The first time the UITableView loads, it hits the DB and gets the info. I "tab" back to the UIView w/UITextViews select some data, and then "tab" back to the UITableView, but none of the delegate methods get called, like viewDidLoad or initWithNibName or anything, thus the data in the table is stale.
So, I found out the method
-(void)viewWillAppear:(BOOL)animated {
is called, HOWEVER, it doesn't have access to the tableView, like say,
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
I did stumble upon this recommendation:
"I can't seem to figure out how to make the UITableView refresh ... I did find this, which seems like the same problem I'm having,
What I did is to create a MyTableViewController* property in MyModalViewController class. Before presentModalView, I store the table view controller pointer to this property in modal view controller.
Now I have a reference to table view controller when I'm in the modal view controller. Now just use this stored table view controller to locate its tableView, then reloadData.
Feels dirty but gets work done."
If that's the answer, I'm not sure how to code it.
Thanks ahead!
- sk
Note: I just tried this:
.h
UITableView *tableViewPtr;
@property (nonatomic, retain) UITableView *tableViewPtr;
.m
@synthesize tableViewPtr;
And store it in -
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {:
...
self.tableViewPtr = tableView;
...
Then try to call it from
-(void)viewWillAppear:(BOOL)animated {
[self.tableViewPtr reloadData];
But that doesn't seem to work.