Hi,
I've been trying to figure out how to draw a shadow for an UIView that was added inside a UIView with addSubview.
I searched online and read the docs, but the Apple docs simply draw new shapes as shown below. I want to use the Core Graphics to add a shadow to the UIView, but am unsure how to do this to a UIView directly.
CGContextRef myContext = UIGraphicsGetCurrentContext();
//CGContextRef myContext = myCGREF;
CGSize myShadowOffset = CGSizeMake (10, 10);// 2
CGContextSetShadow (myContext, myShadowOffset, 0); // 3
CGContextBeginTransparencyLayer (myContext, NULL);// 4
// Your drawing code here// 5
CGContextSetRGBFillColor (myContext, 0, 1, 0, 1);
CGContextFillRect (myContext, CGRectMake (a_view.frame.origin.x, a_view.frame.origin.y , wd, ht));
CGContextEndTransparencyLayer (myContext);// 6
I know I should put this in the SuperView drawRect method, but I don't know how to make it so it adds a shadow to the views I add in addSubView.
Thanks!