I have my UIView
. I draw something in my UIView
. I added a CALayer
to my UIView
. Now I would like my controller to only redraw my added CALayer.
How do I do that ?
In my actual Code it will redraw the main view. How can I redraw my subview (myshapelayer) ?
override func drawRect(rect: CGRect) {
var myshapelayer:CAShapeLayer=CAShapeLayer();
var testbezier:UIBezierPath=UIBezierPath();
testbezier.moveToPoint(CGPoint(x: 60, y: 80));
...
...
myshapelayer.strokeColor=UIColor.blueColor().CGColor;
myshapelayer.path=testbezier.CGPath;
newlayer.addSublayer(myshapelayer)
<draw on my main view>
Controller:
myview.setNeedsDisplay();