开发者

using CGContext to draw the shapes of the views

How can I draw a triangle, say, shaped view with the help of core-graphics drawing techni开发者_如何学编程ques?


Implement drawRect on your view, and then just use the CGContextDraw-type methods to draw whatever you want. It'll draw on the current context, which is your view.


You need to implement drawRect on your view. There are different drawing techniques. You can use bezier path and add it to your context or directly draw using CGContext methods. For example, triangle can be made using two methods CGContextMoveToPoint and CGContextAddLineToPoint. For further understanding refer to docs of CGContext: https://developer.apple.com/library/ios/documentation/graphicsimaging/reference/CGContext/Reference/reference.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜