标签:
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // 创建一个图层 CALayer *layer = [CALayer layer]; // 设置尺寸 layer.bounds = CGRectMake(0, 0, 100, 100); // 设置位置 layer.position = CGPointMake(100, 100); // 设置颜色 layer.backgroundColor = [UIColor redColor].CGColor; // 设置内容 layer.contents = (__bridge id)[UIImage imageNamed:@"阿狸头像"].CGImage; [self.view.layer addSublayer:layer]; }
标签:
原文地址:http://www.cnblogs.com/ios-g/p/4786597.html