On Mar 23, 2012, at 3:24 AM, Rick C. wrote:

> This is what I would expect too.  But drawSegment:inFrame:withView: doesn't 
> override the cell drawing from what I know am I missing something?


That'll draw the interior of the segment. The background is drawn by 
drawWithFrame:inView:, which then calls drawSegment: to draw the interior title 
and image in each segment. So you'll need to replicate that. 

http://code.google.com/p/bghudappkit/source/browse/trunk/Framework/BGHUDSegmentedCell.m?r=167

See this code for an example of doing custom drawing. You'll notice that it has 
to call the private method rectForSegment:inFrame:. You'll want avoid that (for 
the usual reasons) and create your own method which does the same thing.

I remember now one of the problems with subclassing a segmented control is you 
can't change the height of the segments. No matter what the height of the view 
is, the hit testing always uses standard control sizing, so hit testing won't 
line up. So if that's a problem, you'll probably want to make your own control, 
or else you'll have to do your own hit testing and add more voodoo. It takes 
less than 200 lines to create a basic segmented control anyway.


--
Seth Willits

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to