Drawing unicode text and clipping characters
I am looking to draw some unicode text and I am trying to clip the individual characters on the screen. I've only been able to get it to clip the entire character, not partia开发者_如何转开发lly like I need.
Specifically I am trying to clip: ★★★★★ so it will only show a 1/2 of the last star (clipping rect configurable in my code).
I'm not having much luck, i've tried to use CGContextAddRect()
+ CGContextSetDrawingMode()
+ CGContextEOClip()
/CGContextClip()
as well as trying to use NSString
's -drawInRect:
method and also resizing the frame of a UILabel
. All of which have clipped the entire character, so when the width of the rect should have clipped the characters to show a half star like 3.5 stars, it was clipping the entire star and showing 3.0.
I know it would be easy to convert the unicode characters to a simple UIImageView and resize that to achieve clipping, but I would like to know how to do it using drawing methods if possible.
I'm not an iPhone developer, and I know this is a few months old, but I've used ★★★★½ in a similar situation.
精彩评论