Ios 设置UIView';s内容到Calier';iphone中的内容
我正在尝试将视图的内容添加到图层的内容中,是否可能Ios 设置UIView';s内容到Calier';iphone中的内容,ios,iphone,objective-c,uiview,calayer,Ios,Iphone,Objective C,Uiview,Calayer,我正在尝试将视图的内容添加到图层的内容中,是否可能 v1=[[UIView alloc]initWithFrame:CGRectMake(10, 10, 30, 30)]; v1.backgroundColor=[UIColor redColor]; UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(05, 05, 20, 20)]; lbl.text=@"ABC"; [
v1=[[UIView alloc]initWithFrame:CGRectMake(10, 10, 30, 30)];
v1.backgroundColor=[UIColor redColor];
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(05, 05, 20, 20)];
lbl.text=@"ABC";
[v1 addSubview:lbl];
CALayer *iconImageLayer = [[CALayer alloc] init];
iconImageLayer.contents=?????? //Try to add view
帮我解决这个问题
谢谢,使用
UIView
的层
属性
CALayer*iconImageLayer=v1.layer
或者只要简单地使用v1.layer
,无论您在哪里使用iconImageLayer