title: iOS 5 create custom UIButton reusable component with .XIB
body: <p>I'm newbie in the iOS development and I'm working in a projecte that it uses iOS5 and Storyboarding. I would like to create a reusable component, like a button, with a custom view (inside the button there will be some images and labels, it will be a big button), to create some of them in the same view of a Storyboard.
  So I've created a XIB file (ItemClothes.xib) with a UIButton and inside of it some UIImagesViews and a UILabel. Then I've created a subclass of UIButton (UIItemClothes.h and UIItemClothes.m), with properties for UIImageViews and UILabel components.</p>
  
  <p><strong>UIItemClothes.h</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "SCClothes.h"
  
  @interface UIItemClothes : UIButton
  
  @property (nonatomic, strong) IBOutlet UIImageView *imageClothes;
  @property (nonatomic, strong) IBOutlet UIActivityIndicatorView *loadingImage;
  @property (nonatomic, strong) IBOutlet UIImageView *seasonIconClothes;
  @property (nonatomic, strong) IBOutlet UIImageView *categoryIconClothes;
  @property (nonatomic, strong) NSString *idClothes;
  @property (strong, nonatomic) IBOutlet UILabel *lblProva;
  
  @end
  </code></pre>
  
  <p><strong>UIItemClothes.m</strong></p>
  
  <pre><code>#import "UIItemClothes.h"
  
  @implementation UIItemClothes
  
  @synthesize imageClothes = _imageClothes;
  @synthesize loadingImage = _loadingImage;
  @synthesize seasonIconClothes = _seasonIconClothes;
  @synthesize categoryIconClothes = _categoryIconClothes;
  @synthesize idClothes = _idClothes;
  @synthesize lblProva = _lblProva;
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          // Initialization code
          [self addSubview:[[[NSBundle mainBundle] loadNibNamed:@"ItemClothes" owner:self options:nil] objectAtIndex:0]];
      }
      return self;
  }
  
  @end
  </code></pre>
  
  <p>Then in the .XIB file I've set the class of UIButton as UIItemClothes, and make the relationships between XIB's UI components and my class properties.</p>
  
  <p>So, after that, in the Storyboard, in the ViewController of one view I've written this code:</p>
  
  <pre><code>UIItemClothes *item = [[UIItemClothes alloc] initWithFrame:CGRectMake(0.0, 0.0, 200.0, 200.0)];
  item.lblProva.text = @"test!";
  [item.categoryIconClothes setImage:iconCategory];
  item.seasonIconClothes.image = iconSeason;
  [cell addSubview:item];
  </code></pre>
  
  <p>As you see, this component will be inside a TableViewCell, and the idea is to put more components (UIItemClothes) inside of it.</p>
  
  <p>The problem is that the component is drawed but any outlet is set as I do in the code above.</p>
  
  <p>Can anyone help me?
  Thanks!</p>