• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: advice for creating these controls
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: advice for creating these controls


  • Subject: Re: advice for creating these controls
  • From: Seth Willits <email@hidden>
  • Date: Fri, 23 Mar 2012 11:42:14 -0700

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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >Re: advice for creating these controls (From: Lee Ann Rucker <email@hidden>)
 >Re: advice for creating these controls (From: Seth Willits <email@hidden>)
 >Re: advice for creating these controls (From: "Rick C." <email@hidden>)

  • Prev by Date: Re: Missing header files/folders?
  • Next by Date: Re: advice for creating these controls
  • Previous by thread: Re: advice for creating these controls
  • Next by thread: Re: advice for creating these controls
  • Index(es):
    • Date
    • Thread