How to write a Custom UILabel Class
<p>In my project there is a huge number of <code>UILabels</code> available for each screen that's why I have created one separate class for <code>UILabel</code> and I want to set all label properties in that class.</p>

<p>But label properties and label also not adding in my <code>MainViewController</code>.</p>

<p>My code:</p>

<p>CustomLabel:</p>

<pre><code>#import "CustomLabel.h"

@implementation CustomLabel

- (id) init {
    self = [super init];
    if(self){

        [self setupUI];
    }
    return self;
}

- (void)setupUI {

    [self setBackgroundColor:[UIColor redColor]];
    [self setTextColor:[UIColor blackColor]];
}
</code></pre>

<p>MainViewController:</p>

<pre><code>#import "MainViewController.h"
#import "CustomLabel.h"

@interface MainViewController ()
{
    CustomLabel * mainLabel;
}

@end

@implementation SampleViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    mainLabel = [[CustomLabel alloc]initWithFrame:CGRectMake(50, 150, 100, 35)];
    [self.view addSubview:mainLabel];
}

@end
</code></pre>