-
Notifications
You must be signed in to change notification settings - Fork 0
Label in code Objective c 0
Azmal Tech edited this page Dec 27, 2016
·
1 revision
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
NSString *firstname = @"Hello World";
-
(void)viewDidLoad { [super viewDidLoad];
UILabel *name = [[UILabel alloc]initWithFrame:CGRectMake(50, 50, 200, 30)];
name.backgroundColor = [UIColor yellowColor]; // name.text = [NSString stringWithFormat:@"%@",firstname ]; name.text = @"Welcome"; name.textColor = [UIColor greenColor]; name.textAlignment = UITextAlignmentCenter; name.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size: 26]; self.name.text = @"Mohammad \n Azmal"; self.name.numberOfLines = 2; self.name.shadowColor = [UIColor cyanColor]; self.name.shadowOffset = CGSizeMake(2.0, 2.0); // first one is x, second one is y size
[self.view addSubview:name];
}
-
(void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
@end