开发者

using CGContext to draw the shapes of the views

开发者 https://www.devze.com 2023-02-02 22:59 出处:网络
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

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

精彩评论

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