Initializing Detail View from nib with parameters passed from Root View
- by culov
I'm have a map view with a number of annotations on it... once the callout is clicked, i need to pass several parameters to the DetailViewController, so ive been trying to do this through the constructor. I've debugged a bit and discovered that the arguments are being passed properly and are being received as expected within the constructor, but for some reason whenever I try to change the values of the IBOutlets I've positioned in the nib, it never has an effect.
Here's what im passing (btw, im getting a "No initWithNibName : bundle : header' method found" warning at this line):
DetailViewController *dvc = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil header:headerText];
[self.navigationController pushViewController:dvc animated:YES];
Now heres my constructor:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil header:(UILabel*)headerLabel {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
self.headerTextView = headerLabel;
NSLog(@"header:%@", headerLabel.text);
}
return self;
}
Once again, the problem is that headerLabel.text is printed properly in the console, but the line self.headerTextView = headerLabel; doesnt seem to be doing what I want it to do.
Thanks!