How to create DropShadow in UIView

My current code does nothing:

CGContextRef currentContext = UIGraphicsGetCurrentContext();
    CGContextSaveGState(currentContext);

float myColorValues[] = {1.0, 0, 0, .8};
CGColorSpaceRef myColorSpace = CGColorSpaceCreateDeviceRGB();
CGColorRef myColor = CGColorCreate(myColorSpace, myColorValues);
CGContextSetShadowWithColor (currentContext, CGSizeMake(-1, -1), 0, myColor);

//CGContextSetShadow(currentContext, CGSizeMake(-15, 20), 15);


[super drawRect: rect];

CGContextRestoreGState(currentContext);
+3
source share

Source: https://habr.com/ru/post/1741843/


All Articles