Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 89085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:39:41+00:00 2026-05-10T22:39:41+00:00

It seems like more and more OS X apps these days are doing all

  • 0

It seems like more and more OS X apps these days are doing all kinds of fancy drawing stuff for custom controls. Apps like Twitterific, Things, EventBox, Versions just to name a few….

So basically I’m looking for any information on how to get started doing this kind of thing. Not sure if it is just done by subclassing controls and using custom drawing or if it is something entirely different.

Any help is greatly appreciated. THanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:39:41+00:00Added an answer on May 10, 2026 at 10:39 pm

    It depends entirely on what you want to do.

    The ‘Show Raw Properties’ button in Versions for instance is an NSButton subclass, because basically what we needed is standard button behavior with our own look.  One way to subclass a button is to simply implement your own -drawRect:(NSRect)rect method in the NSButton subclass, but we decided to stick with the way NSButton is implemented in Cocoa, meaning most drawing is done by the button’s cell, so the implementation looks like this:

    In the NSButton subclass:

    + (Class) cellClass {     return [OurButtonCell class]; }  - (void)drawRect:(NSRect)rect  {     // first get the cell to draw inside our bounds     // then draw a focus ring if that's appropriate } 

    In the NSButtonCell subclass (OurButtonCell):

    - (void)drawInteriorWithFrame: (NSRect) rect inView: (NSView *) controlView {     // a bunch of drawing code } 

    The Timeline view in Versions is actually a WebView, the page that you see in it uses javascript to collapse headers you click on.

    The rule of thumb I use for where to start out with a custom control is:

    • To customize the look of a standard Cocoa control:
      • subclass the appropriate control (like e.g. NSButton and NSButtonCell)
      • stick as close as makes sense to the way the default control is implemented (e.g. in a buttoncell, start from the existing attributedTitle instance method to draw the button title, unless you always want to draw with the same attributes regardless of what’s set up in IB or if you need to draw with different attributes based on state, such as with the trial expiration button in Versions’ main window)
    • Creating an entirely new UI element:
      • subclass NSView and implement pretty much all mouse and key event handling (within the view, no need to redo ‘hitTest:’) and drawing code yourself.
    • To present something that’s complex, of arbitrary height, but isn’t a table:
      • See if you can do it in HTML, CSS and JS and present it in a WebView.  The web is great at laying out text, so if you can offload that responsibility to your WebView, that can be a huge savings in pain in the neck.

    Recommended reading on learning how to draw stuff in your own custom view’s drawing methods: Cocoa Drawing Guide

    Customizing the look of for instance an NSTableView is an entirely other cup of tea, thanks to the complexity of a tableview, that can happen all over the place.  You’ll be implementing your own custom cells for some things you want to do in a table, but will have to change the way rows are highlighted in a subclass of the actual NSTableView object itself.  See for instance the source code for iTableView on Matt Gemmell’s site for a clear example of where to draw what.

    Finally, I think Abizer’s suggestion to go check out the code of BWToolkit is a great idea.  It might be a bit overwhelming at first, but if you can read and understand that code you’ll have no trouble implementing your own custom views and controls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 83k
  • Answers 83k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer We use CozyRoc on our production platform and have done… May 11, 2026 at 4:50 pm
  • Editorial Team
    Editorial Team added an answer You could do: MemoryStream memoryStream = new MemoryStream(); TextWriter tw… May 11, 2026 at 4:50 pm
  • Editorial Team
    Editorial Team added an answer Unfortunately you don't have many choices and none is perfect.… May 11, 2026 at 4:50 pm

Related Questions

I'd like to indicate to the user of a web app that a long-running
Okay, I get it. Data in PostgreSQL is case-sensitive. And I know I can
I've been working on a comprehensive build system that performs distributed builds on multiple
I'm trying to run Python scripts using Xcode's User Scripts menu. The issue I'm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.