Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Amit Jain

macrumors member
Original poster
Apr 9, 2007
45
0
Hi All,

I will directly start from an ex:
I have two classes A and B, both are derived from UITableViewController.

I have also added them into navigation controller so there is navigation going on from A to B. These both classes use database for showing data into the table. Now in B View I delete a row from the DB and A view displays the row count of that DB table. Now what I am doing is on the BACK button of the navigation I want to I am calling this method
TRY 1:
Code:
//in class B
-(IBAction)backBtnPressed
{
[ObjA.tbleView reloadData];
[self.navigationController popViewControllerAnitmated:YES]; 
}
on its action. The problem is this method does not reload the data of View A. i.e., it doesn't call the tbleView's delegate methods like cellForIndexPath...etc.
Then I thought that may the reloadData shud be called from the same class so did this
TRY 2:
Code:
//in class B
-(IBAction)backBtnPressed
{
[ObjA.tbleView myReloadData];
[self.navigationController popViewControllerAnitmated:YES]; 
}
//Class A
-(void)myReloadData
{
[self.tbleView reloadData];
}
It comes into this method but still doesn't call the tableView delegate methods. Please let me know why I am not able to do this silly thing :(.
Regards..
Amit
 
If these view controllers are really derived from UITableViewController then their property is self.tableView, not self.tbleView. Not sure why there's a discrepancy.

What is the value of the property that you're using? self.tbleView. Is it nil or not?

The code you show should work.

You can just as easily do this by calling reloadData from viewWillAppear or viewDidAppear.
 
If these view controllers are really derived from UITableViewController then their property is self.tableView, not self.tbleView. Not sure why there's a discrepancy.

What is the value of the property that you're using? self.tbleView. Is it nil or not?

The code you show should work.

You can just as easily do this by calling reloadData from viewWillAppear or viewDidAppear.

I would like to describe the calling of viewControllers in my code:
I have a rootViewController (added in mainWindow.xib) the viewWillAppear method of this class is called perfectly. I will give you the caling hiearchy of methods :
applicationDidFinishLaunching-->[rootViewController viewdidload]-->in viewDidLoad of rootView i have loaded another viewController that has tabbar on it having 4 classes(A,B,C & D). So by default 1st class (i.e A ) viewDidLoad is called. Class A has a tableView control and added as navigation control so that clicking on any rows navigates to another classes viewControllers (A-->X-->Y..). The problem here is only rootviews viewWillAppear method is called rest of the classes (A or X or Y..) viewWillApperar method is not called.
I hope you are not confused ). Please help i am stuck from many days in this problem .
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.