how to set different brush patterns iphone
I set brush pattern using CGContext and Bezierpath on UIImageView.
Is this a good approach?
Do we have any other开发者_JS百科 best practices to set brush pattern, to create different paint brush pattern.
Does anybody have different design pattern that I can use when implementing my brush?
Yes, it's fine if that's what you want to do. All a "brush" means in this context is how you want to stroke a line. If you're just trying to set the stroke pattern for a bezier path on some UIImageView then yes, it sounds like what you're doing is appropriate.
Now, depending on what your end goal is, there may be different ways to approach it. Your method might have complications when interacting with the higher level drawing in UIKit. Since you asked this 7 months ago though, I'm hoping you already figured it out.
If you are using bezierpath then you can use patternImage code in bezierpath. If you are using CGContext then adjust your strokewidth and use kcglinecap methods to get different points.
In bezierpath you can also use dashpattern so you can draw dash lines.
精彩评论