I’m trying to understand why:
NSLog(@"self = %p", self);
in awakeFromNib prints a different value than the same NSLog in viewDidLoad?
This isn’t a huge problem because I don’t need the awakeFromNib but I would like to understand how it works.
The code that creates the controller is the following:
MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
myViewController.image = tmpImage;
[self.navigationController pushViewController:myViewController animated:YES];
[myViewController release];
Thanks for any advices!
Because when NSLog logs an object, it actually sends the
- descriptionmessage to the object. The address you are printing is actually the address of the returned NSString object containing the textual description of the instances. Since a new string is returned each time the message is sent, you get a different address.If you want the address of the object you need to use: