I have a UIViewController (ContentViewController ) wired to a View xib. I drop a TextView on the UIView and it appears as a subview in the hierarchy in IB. ContentViewController has a label as an outlet, which is wired to a label on ContentView.xib. When the code below executes, the first view shows the text view but scrolling through the other views/pages reveals only the label.
for(int i=0; i< 5; i++){
ContentViewController *contentView = [[ContentViewController alloc] initWithNibName:@"ContentView" bundle:[NSBundle mainBundle]];
[contentView loadView];
contentView.theLabel.text =[NSString stringWithFormat:@"hello again..%d", i];
[self.scrollView addSubview:contentView.view];
}
I can drag a button or textfield onto the view in IB and they are all there as I scroll through pages. The above text is set on the label as well. The textview disappears after the first page. I also can't set its text. I've dragged a new textview onto the UIView and it disappears after the first page as well. Is there something different I need to do for the textview?
Addendum:
I've found that the UIScrollView is on each page. If I swipe vertically where the scrollview is, text will appear. But I have to do that for all scrollviews after the first one. However, once I swipe them, the text remains visible until the app is restarted. If there isn't enough text to cause scrolling, the textview will never appear. Any suggestions on this behavior?