title: iOS Subclassing a Custom Class
body: <p>I'm having trouble wrapping my thoughts about class inheritance. I'm suppsed to create a dashboard like interface in a app, and I'll have maybe 10 widgets/dashlets on that dashboard view. All those dashlets/widgets will have basically same look, with a title on the top, borders, row of buttons on the top and a graph.
  Let's say I create a subclass of UI View called 'Dashlet' with properties and outlets, and create XIB file with proper layout and connected outlets etc.</p>
  
  <p>Now I want to create several subclasses of that 'Dashlet' view that will only process data differently, and draw different graphs. My current code looks something like this:</p>
  
  <p>Dashlet.h</p>
  
  <pre><code>@interface Dashlet : UIView{
  @private
      UILabel *title;
      UIView *controls;
      UIView *graph;    
  }
  @property (weak, nonatomic) IBOutlet UILabel *title;
  @property (weak, nonatomic) IBOutlet UIView *controls;
  @property (weak, nonatomic) IBOutlet UIView *graph;
  
  -(Dashlet*)initWithParams:(NSMutableDictionary *)params;
  -(void)someDummyMethod;
  @end
  </code></pre>
  
  <p>And in Dashlet.m</p>
  
  <pre><code>- (id) init {
      self = [super init];
      //Basic empty init...
      return self;
  }
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
  
      }
      return self;
  }
  
  -(id)initWithParams:(NSMutableDictionary *)params
  {
      self = [super init];
      if (self) {
          self = [[[NSBundle mainBundle] loadNibNamed:@"Dashlet" owner:nil options:nil] lastObject];
          //some init code
      }
      return self;
  }
  </code></pre>
  
  <p>Now let's say that I create a subclass called CustomDashlet.h:</p>
  
  <pre><code>@interface CustomDashlet : Dashlet
  @property (nonatomic, strong) NSString* test;
  -(void)testMethod;
  -(void)someDummyMethod;
  @end
  </code></pre>
  
  <p>and CustomDashlet.m</p>
  
  <pre><code>-(id)init{
      return self;
  }
  
  - (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
  
      }
      return self;
  }
  
  -(id)initWithParams:(NSMutableDictionary *)parameters
  {
     self = [super initWithParams:parameters];
     if (self) {
        //do some stuff 
     }
     return self;
  }
  </code></pre>
  
  <p>This, kind of works, but I need to override some of the methods declared in the superclass or even add some of my own. Whenever i try to do something like this in CustomDashlet.m</p>
  
  <p><code>[self someDummyMethod]</code> or even <code>[self testMethod]</code> I get an exception error like this:</p>
  
  <pre><code>NSInvalidArgumentException', reason: '-[Dashlet testMethod]: unrecognized selector sent to instance 
  </code></pre>
  
  <p>Am I even doing this right? Did I miss something? Am I supposed to make this work in some other way? If anyone has  suggestions, please feel free to share your thoughts, thank you for all the help.</p>