UIImage as CAShapeLayer contents

后端 未结 5 1821
遥遥无期
遥遥无期 2021-01-14 17:23

If I create a CAShapeLayer with just a background color it shows up, but if i set the content to an image, nothing shows.

CAShapeLayer* leftDot = [CAShapeLa         


        
5条回答
  •  囚心锁ツ
    2021-01-14 17:55

    You have to set the CGImage for the layer

    leftDot.fillColor=[UIColor clearColor].CGColor ;
    [leftDot setContents:(__bridge id)[UIImage imageNamed: @"glow.png"].CGImage];
    

提交回复
热议问题