【代码笔记】iOS-导航条的标题(label)

来源:互联网 发布:出纳软件怎么用 编辑:程序博客网 时间:2024/05/21 14:03

一,效果图。

二,代码。

复制代码
- (void)viewDidLoad {    [super viewDidLoad];    // Do any additional setup after loading the view, typically from a nib.        [self.view addSubview:[self getTileLabel:@"你好!"]];    }//导航条的标题-(UILabel *)getTileLabel:(NSString *)title{        UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 100 , 200, 44)];    titleLabel.backgroundColor = [UIColor redColor];    titleLabel.font=[UIFont boldSystemFontOfSize:18];    titleLabel.textColor=[UIColor greenColor];    titleLabel.textAlignment = NSTextAlignmentCenter;    titleLabel.text=title;    return titleLabel;}
复制代码
阅读全文
0 0
原创粉丝点击