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

belsokar

macrumors member
Original poster
Jul 21, 2005
80
43
So, I have a basic UITableViewController that navigates to a UIViewController from the table's row objects.

so: UITableView.Row -> (selected) -> opens UIViewController View.

When I open the UIViewController view, I do a database call to look up some details for the object id that was selected in the parent TableViewController.

I had one issue however,...whenver I paged back to the previous view via the NavigationController, and selected a new row, the view was not updating the NavigationTitle.

I found that my original code was only loading once and setting the title of the navigation controller. It never refreshed after the first call to the view:

Code:
- (void)viewDidLoad
{
    self.title = newname;
}

I then used the loadView overload instead of the viewDidLoad, and that worked:

Code:
- (void)loadView
{
    self.title = newname;
}


Upon debugging however, I found that the 'loadView' method was executed 4 times everytime. While not a major call, just wondering why this is happening. I have stepped through the code line by line and this is what I find.

I get a bunch of these messages in the console: "Unable to disassemble objc_msgSend."

Furthermore, when looking at the stack trace, I see the following in my trace:

Code:
[UIViewController view]
[UINaviagationController -startTransition:fromViewController:toViewController:]
[UINavigationController pushViewController:transition:forceimmediate:]
[UINavigationController pushViewController:animated:]
[ViewController tableView:didSelectRowAtIndexPath:]

Essentially, all I'm looking for is a way to have the view refreshed with the new data after the data has been loaded. It's working, but I'm not sure this is what it's supposed to do!
 
Last edited by a moderator:
Any solution to this?

So, I have a basic UITableViewController that navigates to a UIViewController from the table's row objects.

so: UITableView.Row -> (selected) -> opens UIViewController View.

When I open the UIViewController view, I do a database call to look up some details for the object id that was selected in the parent TableViewController.

I had one issue however,...whenver I paged back to the previous view via the NavigationController, and selected a new row, the view was not updating the NavigationTitle.

I found that my original code was only loading once and setting the title of the navigation controller. It never refreshed after the first call to the view:

Code:
- (void)viewDidLoad
{
    self.title = newname;
}

I then used the loadView overload instead of the viewDidLoad, and that worked:

Code:
- (void)loadView
{
    self.title = newname;
}


Upon debugging however, I found that the 'loadView' method was executed 4 times everytime. While not a major call, just wondering why this is happening. I have stepped through the code line by line and this is what I find.

I get a bunch of these messages in the console: "Unable to disassemble objc_msgSend."

Furthermore, when looking at the stack trace, I see the following in my trace:

Code:
[UIViewController view]
[UINaviagationController -startTransition:fromViewController:toViewController:]
[UINavigationController pushViewController:transition:forceimmediate:]
[UINavigationController pushViewController:animated:]
[ViewController tableView:didSelectRowAtIndexPath:]

Essentially, all I'm looking for is a way to have the view refreshed with the new data after the data has been loaded. It's working, but I'm not sure this is what it's supposed to do!

Hey,

I'm facing the same problem now. Have you got any solution for this? if so, can you please help me?

Thanks in advance.
 
Last edited by a moderator:
all it requires to set view for the view controller
which means you need to do as follows

Code:
- (void)loadView
{

self.title = newname;

UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,180)];

// now you can add subview to your view
// [v addSubView:v1];
self.view = v;

[v release];
}
 
Last edited by a moderator:
You need to call [super loadView] if using the method loadView. It is better to use the method viewDidLoad instead. In such case comment or delete the method loadView.

Code:
-(void)loadView
{
    [super loadView];
    //code 
}
 
Last edited by a moderator:
Forget all the viewload stuff, I wanna know how you got 6,200 views on this thread! :eek:

If you can do that with an app... you'd be RICH!!


Ok, I get it...
Take a thread from 3.5 years ago, and answer it! Works every time :rolleyes:

Let's all wait and see if belsokar from 2008 chimes back in on this one.
 
I am a newbie on iOS development, I got the same issue yesterday and I searched , found this thread. But I found noone answered this yet. But after some time I got it fixed by the described method. So I thought it will be good if I post my solution.. Anyway I am not at all worried about the numbers here
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.