IOS基础UI操作UILabel

2019-04-19  本文已影响0人  KevenT
UILabel之小白学习纪录篇

UILabel *newLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 300, width, height)];
[self.view addSubview:newLabel];
[newLabel setText:@"我被改变了"];
//或者
newLabel.text = @"我被改变了";
[newLabel setTextColor:[UIColor blackColor]];
[newLabel setFont:[UIFont systemFontOfSize:12]];
//居左NSTextAlignmentLeft\居中NSTextAlignmentCenter\居右NSTextAlignmentRight
[newLabel setTextAlignment:NSTextAlignmentCenter];]
[newLabel setShadowColor:[UIColor greenColor]];
[newLabel setShadowOffset:CGSizeMake(0,-2)];
newLabel.numberOfLines = 0;
newLabel.adjustFontSizeToFitWidth = YES;
newLabel.highlighted = YES;
newLabel.highlightedTextColor = [UIColor redColor];
nameLabel.userInteractionEnabled = YES;
nameLabel.enabled = NO;
上一篇下一篇

猜你喜欢

热点阅读