If you need a form without content, you can create a CAShapeLayer and add it to your layer. (In fact, you can also post content there using this method, but you need to change it a bit).
CAShapeLayer *layer = [CAShapeLayer layer]; UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:CGPointMake(0, 100)];
This does not require the use of drawRect or anything else. You will need to change the coordinates based on the desired values.
You can also subclass UIView and override drawRect . It takes more work, but UIBezierPath will be pretty much the same.
CALayer very powerful and much used by Apple. For example, the editing canvas on Pages is written almost exclusively using CALayer s.
Fogmeister
source share