I have two View Controllers:
MainVC. I also have a nib file called
SavePopOver has three items, a
UIImage and a
UITextView. The image and text view have outlets to
property fields in
SavePopOverVC called captionImage and captionTextView respectively. The button has an outlet to an
MainVC.m I have the following two lines in my class extension.
SavePopOverVC *spvc; UIPopoverController *popover;
viewDidLoad of the same file I have the following lines relating to my popover.
spvc = [[SavePopOverVC alloc] initWithNibNamed:@"SavePopOver" bundle:nil]; popover = [[UIPopoverController alloc] initWithContentViewController:spvc];
In my function that displays my popover, also in
MainVC.m, I have the following lines.
[popover setPopoverContentSize:CGSizeMake(600,200)]; [popover presentPopoverFromRect:_header.frame inView:self.view permittedArrowDirection:UIPopoverArrowDirectionAny animated:YES]; [((SavePopOverVC *)popover.contentViewController).captionTextView setText:@"Some text here"];
captionTextView is nil when I make the
setText: call. The app doesn’t crash but the text isn’t set. After the popover is displayed and I click on the
UIButton to save the string typed in
captionTextView I get the string just fine. So, I know the two are ultimately linked correctly, but how can I set
captionTextView from when I display the popover?
If it is worth noting, I’m developing solely for iPad with this one.