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 8811267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:19:15+00:00 2026-06-14T03:19:15+00:00

I am trying to tackle a problem which sounds pretty simple: changing the background

  • 0

I am trying to tackle a problem which sounds pretty simple: changing the background color of an NSPopupButton.

Interface Builder only allows changing the style to a pre-defined one and doesn’t allow changing the background color. Also, setting up an IBOutlet didn’t help since NSPopupButton doesn’t have a setBackgroundColor method.

I also tried subclassing NSPopupButton to override the drawRect method. Here’s what I have tried:

- (void)drawRect:(NSRect)dirtyRect
{
    [[NSColor redColor] setFill];
    NSRectFill(dirtyRect);
}

This draws a red rectangle over the NSPopupButton rather than setting it as a background color.

Any ideas on how to go about solving this?

  • 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. Editorial Team
    Editorial Team
    2026-06-14T03:19:16+00:00Added an answer on June 14, 2026 at 3:19 am

    You should create a subclass of NSPopUpButtonCell, then override

    - (void)drawBezelWithFrame:(NSRect)frame inView:(NSView *)controlView
    

    NSPopupButtonCell is a subclass of NSButtonCell which defines several methods for drawing individual cell components, eg bezel, title, image.

    You can then expand the NSPopupButton and change its cell subclass to your new subclass and it should use your drawing methods.

    Cocoa primarily uses NSCell to handle drawing, unlike iOS

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

Sidebar

Related Questions

I'm trying to tackle a problem that seemingly many Android developers have, which is
I have this problem I've been trying to tackle for a while. I have
I'm trying to whip up a POC of a system which allows you to
I'm trying to tackle the problem of disconnected operation for an application with a
I am trying to figure out how to tackle this problem. I have to
Hi there guys trying to gather some ideas to tackle this problem. i am
While trying to tackle a more complex problem, I came to compare access speed
I have a problem. I've been trying to tackle it for a while now
I've been trying to tackle this problem for a day and half now and
I have been trying to tackle this problem , but I am having difficulty

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.