title: Can't access and set Text of UILabel in a programmatically loaded XIB
body: <p>This is my first time posting on StackOverflow - been pulling my hair out on this one for too long. Hoping the community here can help.  </p>
  
  <p>I've setup a UIScrollView/PageControl to page through 4 pages.  I'm trying to load a .xib into the ScrollView 4 times, each time with a different text and image.  </p>
  
  <p>Unfortunately, I'm able to load the xib, but not able to change the text/image, I'm not sure why.  I think it might have something to do with not being able to access the UILabel of the loaded NIB in my ViewController.</p>
  
  <p>Here's the .h file of the CardView.xib (CardView.h):</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface BMTutorialCardView : UIView
  
  @property (strong, nonatomic) IBOutlet UIView *contentView;
  @property (weak, nonatomic) IBOutlet UIImageView *cardImage;
  @property (weak, nonatomic) IBOutlet UILabel *cardLabel;
  
  @end
  </code></pre>
  
  <p>And here's the CardView.m file:</p>
  
  <pre><code>#import "CardView.h"
  
  @implementation CardView
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          // Initialization code
          UIView *xibView = [[[NSBundle mainBundle] loadNibNamed:@"BMTutorialCardView" owner:self options:nil] objectAtIndex:0];
          [self addSubview:xibView];
      }
      return self;
  }
  @end
  </code></pre>
  
  <p>I hooked up both the UIImageView and UILabel outlets from the xib to CardView.h.</p>
  
  <p>Now in my ViewController, I add the xib 4 times into my scrollView:</p>
  
  <pre><code>@implementation BMViewController
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      for (int i = 0; i &lt; 4; i++) {
          CGRect frame;
          frame.origin.x = self.scrollView.frame.size.width * i;
          frame.origin.y = 0;
          frame.size = self.scrollView.frame.size;
  
          CardView *subview = [[BMTutorialCardView alloc] initWithFrame:frame];
  
          //The following line doesn't change the text.
          subview.cardLabel.text = @"This line doesn't change the text on the label";
          [self.scrollView addSubview:subview];
      }
  
      self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * 4, self.scrollView.frame.size.height);
  }
  </code></pre>
  
  <p>I'm not sure why subview.cardLabel.text doesn't actually change the text. It seems like subview.cardLabel is nil, but I clearly see the UILabel with the default text that I had in the xib when iOS simulator is run.</p>