Example Code of UILabel

  1. Create a UILabel called ‘welcome’ that has nonatomic and weak property.

@property (nonatomic, weak) IBOutlet UILabel *welcome;

  • IBOutlet makes Interface Builder recognize the outlet
  • weak is used because in most situations the owner of the outlet isn’t the same as the owner of the view. For example, a view controller doesn’t own someLabel – the view controller’s view does.

2. Set up text for UILabel ‘welcome’

welcome.text = @”Welcome to use Tech Geek!”;

3. Set up the font

welcome.font = [UIFont fontWithName:@Arial size:30];

4. Set up text color

welcome.textColor = [UIColor blueColor];

Read More:

How to create a link between “code” and “User Interface” (Storyboard)