Shadow or Border around a scrollview iphone

前端 未结 4 1874
谎友^
谎友^ 2021-01-05 06:19

i would like to draw a border / shadow around a uiscrollview, i know that i could get there with an additional view or scrollview but dont like the handling an drawbacks but

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-05 06:39

    myView.layout.borderColor generates an incompatible pointer warning when using UIColor, and did not change the border for me.

    Using CGColorRef worked for me instead:

    CGFloat lComponents[4] = {0,0,0,1};
    CGColorSpaceRef lColorSpace = CGColorSpaceCreateDeviceRGB();
    myView.layer.borderColor = CGColorCreate(lColorSpace, lComponents);
    CGColorSpaceRelease(lColorSpace);
    

提交回复
热议问题