iOS开发视频教程-第一季
-
(第一集:iOS历史介绍)
-
(第二集:xcode安装)
-
(第三集:UIView)-边框frame、边界bounds、中心center
-
(第四集:UILabel) UILabel主要属性:NSString *text-文本、UIFont *font-字体、UIColor *textColor-文本颜色、UILineBreakMode lineBreakMode-文本这行的模式、UITextAlignment textAlignment-文本的对齐方式(有左中右) UILabel和字体大小匹配 `- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSString *s = @“mai.yang是饭特稀娱乐体育的后台开发工程师,android和ios客户端开发工程师”; UIFont *font = [UIFont fontWithName:@“Arial” size:50.0f]; CGSize size = CGSizeMake(320, 300);// 超过指定的高度300后,系统会自动将超长的截断用…表示 UILabel *label2 = [[UILabel alloc] initWithFrame:CGRectZero]; [label2 setNumberOfLines:0];
CGSize labelSize = [s sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByWordWrapping];
label2.frame = CGRectMake(0, 0, labelSize.width, labelSize.height); label2.textColor = [UIColor blackColor]; label2.font = font; label2.text = s;
[self.view addSubview:label2]; }`







