Create your own class subclassing UIView, then override initWithFrame or drawRect. Overriding initWithFrame is easier for a newbie.
Your header (.h) file should start with this:
@interface YourOwnView : UIView
...
@end
Then, in the implementation file (.m) you should implement your own initWithFrame.
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
//ADDING NEW CONTENT
UILabel *yourLabel = [[UILabel alloc]init];
//CUSTOMIZE your label's font, text, etc.
....
//Add your label to your own view
[self addSubview:yourLabel];
}
return self;
}
You might need extra data or options in the initializer, for example the text for labels. In this case you could define an init method with extra arguments like this:
- (id)initWithFrame:(CGRect)frame andLabelText:(NSString *)labelText;