title: How to write init method for custom UIView class with xib file
body: <p>I have created simple view using interface builder. This view has one label. Do you know how to create init method for this class ? I wrote my own version but I am not sure that it is correct or not.</p>
  
  <pre><code>@interface AHeaderView ()
  @property (nonatomic, weak) IBOutlet UILabel *descriptionLabel;
  
  @end
  
  @implementation AHeaderView
  
  - (id)initWithFrame:(CGRect)frame {
      self = [super initWithFrame:frame];
      if (self) {
          // add subview from nib file
          NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"AHeaderView" owner:nil options:nil];
  
          AHeaderView *plainView = [nibContents lastObject];
          plainView.descriptionLabel.text = @"localised string";
          [self addSubview:plainView];
      }
      return self;
  }
  </code></pre>
  
  <p>-------------------------------- version 2 ---------------------------------</p>
  
  <pre><code>@interface AHeaderView ()
  @property (nonatomic, weak) IBOutlet UILabel *descriptionLabel;
  
  @end
  
  @implementation AHeaderView
  
  - (id)initWithCoder:(NSCoder *)aDecoder {
      self = [super initWithCoder:aDecoder];
      if (self) {
          self.descriptionLabel.text = @"localised string"
      }
      return self;
  }
  </code></pre>
  
  <p>loading in ViewController class:</p>
  
  <pre><code>NSArray *nibContents = [[NSBundle mainBundle] loadNibNamed:@"AHeaderView" owner:nil options:nil];
  AHeaderView *headerView = [nibContents lastObject];
  </code></pre>
  
  <p>------- version 3 -------</p>
  
  <pre><code>@interface AHeaderView ()
  @property (nonatomic, weak) IBOutlet UILabel *descriptionLabel;
  
  @end
  
  @implementation AHeaderView
  
  - (void)awakeFromNib {
      [super awakeFromNib];
      self.descriptionLabel.text = @"localised string"
  }
  
  @end
  </code></pre>