Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/122.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 设置UIView';s内容到Calier';iphone中的内容_Ios_Iphone_Objective C_Uiview_Calayer - Fatal编程技术网

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