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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:23:27+00:00 2026-06-06T16:23:27+00:00

I have a basic Cocoa app with a custom NSCollectionView that overrides drawRect: to

  • 0

I have a basic Cocoa app with a custom NSCollectionView that overrides drawRect: to draw a red background (for illustration purposes).

I noticed that at seemingly random times, drawRect: would not be called although I invoked setNeedsDisplay:YES. Other times it worked and the collection view had a red background.

It took me a few hours, but then I finally noticed that high up in the view hierarchy one of the parent views was a layer-backed view (I had “Core Animation Layer” checked in Interface Builder to add a shadow to an element).

Changing that parent view to not use layer-backing immediately solved the problem and drawRect: is then always called as expected.

What puzzles me is that with layer-backing enabled on a parent view, drawRect: would be called sometimes, but not always.

Should I assume that I can’t reliably override drawRect: in any subview if a parent view is layer-backed?

  • 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-06T16:23:28+00:00Added an answer on June 6, 2026 at 4:23 pm

    Watch the WWDC 2012 video on layer-backed views, and read the documentation for -layerContentsRedrawPolicy. Sounds like you want NSViewLayerContentsRedrawOnSetNeedsDisplay.

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

Sidebar

Related Questions

I have a Cocoa document-based app that (currently at least) functions as a basic
I want to test that my Cocoa app properly handles input outside the basic
I have a Cocoa app that uses otool to find required shared libraries that
I have a basic web service that returns the following object as JSON: public
I have an requirement to implement a custom keyboard for a Cocoa Touch data
I have basic code that looks like this: while(inputfileStream.good()) { for(int i = 0;i<levels;i++)
I have a cocoa class set up that I want to use to connect
I have a small app that uses cocos2d to run through four levels of
Recently I have been developing an app that needs AES encryption. I am using
It seems that if I want to create a very basic Cocoa application with

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.