使用CAShapeLayer爲實現這一
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path,NULL,0.0,200.0);
CGPathAddLineToPoint(path, NULL, 320.0f, 250.0f);
CGPathAddLineToPoint(path, NULL, 320.0f, 367.0f);
CGPathAddLineToPoint(path, NULL, 0.0f, 367.0f);
CGPathAddLineToPoint(path, NULL, 0.0f, 200.0f);
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
[shapeLayer setPath:path];
[shapeLayer setFillColor:[[UIColor redColor] CGColor]];
[shapeLayer setStrokeColor:[[UIColor blackColor] CGColor]];
[shapeLayer setBounds:CGRectMake(0.0f, 0.0f, 160.0f, 480)];
[shapeLayer setAnchorPoint:CGPointMake(0.0f, 0.0f)];
[shapeLayer setPosition:CGPointMake(0.0f, 0.0f)];
[[[self view] layer] addSublayer:shapeLayer];
CGPathRelease(path);
我已經移除素標記從旋轉視圖並將它們放在主視圖上。 – Optimistic
@MidhunMP:檢查更新的問題。請幫助我。 – Optimistic
您可以使用CAShapeLayer和CATextLayer來做同樣的事情,也請檢查CoreText和NSAttributedString。 –