iOS开发笔记--详解UILabel的相关属性设置

2020-01-18 16:59:29刘景俊

然后在主函数中调用即可


CGSize size= CGSizeMake(100, 200);  
  UIImage *image =[UIImage imageNamed:@"1.jpg"];  
  UIImage *laterImage =[self scaleImage:image ToSize:size];  
  UIColor * color = [UIColor colorWithPatternImage:laterImage];  
  UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(50, 50, 100, 200)];  
  [label setBackgroundColor:color];  
  [self.view addSubview:label];  

设置高亮


label.highLighted =YES; 

设置文本阴影


label.shadowColor =[UIColor grayColor];  

设置阴影大小


label.shadowOffset = CGSizeMake(2.0, 2.0);  

设置label圆角


label.layer.cornerRadius = 10;  

要是用这样的设置要先在头文件中加上#import<QuartzCore/QuartzCore.h>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持ASPKU。


注:相关教程知识阅读请移步到IOS开发频道。