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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:32:46+00:00 2026-06-10T20:32:46+00:00

I have a Mac app that’s using IKImageBrowserView. I’ve subclassed IKImageBrowserView and I’m returning

  • 0

I have a Mac app that’s using IKImageBrowserView. I’ve subclassed IKImageBrowserView and I’m returning a custom cell type from newCellForRepresentedItem.

In my cell, I’m creating and returning a layer from layerForType:

// When asked for a foreground layer, return a new layer that we'll render the icon decorations into
- (CALayer *)layerForType:(NSString *)type {
    if ([type isEqualToString:IKImageBrowserCellForegroundLayer]) {
        @synchronized(self) {
            if (!self.foregroundLayer) {
                self.foregroundLayer = [[CALayer alloc] init];
                self.foregroundLayer.delegate = self;
                self.foregroundLayer.needsDisplayOnBoundsChange = YES;
                [self.foregroundLayer setNeedsDisplay];
            }
        }

        return self.foregroundLayer;
    } else {
        return [super layerForType:type];
    }
}

I have my cell observing an object, and calling setNeedsDisplay on my custom layer when it changes.

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context 
{
    [[NSOperationQueue mainQueue] addOperationWithBlock:^{
        self.percentDone = (float)self.bytesSoFar/self.bytesTotal;
        NSLog(@"Update");
        [self.foregroundLayer setNeedsDisplay];
    }];
}

Here’s the problem I’m having: The download proceeds, the object being observed fires the observer (so observeValueForKeyPath is called) and setNeedsDisplay is called. I verified this by logging with NSLog messages.

But the drawing method:

- (void)drawLayer:(CALayer *)theLayer
        inContext:(CGContextRef)theContext
{
    NSLog(@"Drawing");
    // Drawing happens here 
}

What I’m seeing is that the drawing starts out okay – printing “Update” and “Drawing” interleaved – but after a short time, the “Drawing” stops and just the “Update” messages continue.

If I click in the image browser, or tap a key on the keyboard, the “Drawing” resumes for a short while, and then stops, back to just “Update”.

It’s like I need to trigger a repaint using the keyboard or mouse – the setNeedsDisplay isn’t doing it – but I don’t understand why. It does work for a short time, stops working, then only works while I’m providing mouse input.

This has me baffled. I’d appreciate any suggestions.

  • 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-10T20:32:47+00:00Added an answer on June 10, 2026 at 8:32 pm

    I didn’t find the problem here, but I did find a solution.

    Invalidating IKImageBrowserView cells doesn’t cause them to be repainted because IKImageBrowserView, probably for performance, doesn’t redraw cells unless their version changes.

    Instead of invalidating the cell, I now increment the imageVersion returned by my IKImageBrowserItem, and then invalidate the IKImageBrowserView. This reliably redraws the item.

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

Sidebar

Related Questions

We have a Mac OS X app that tags various folders & files from
I have a very simple Mac Cocoa app that just has a Web View
I have a graphics editing cocoa app on Mac OSX that produces 32 by
I have an iPhone app that publishes through Bonjour. The Mac counterpart works, they
By now all Mac App Store developers know that all apps must have the
I have an app on the mac and iPad that stores many images in
I am using Xcode to create an Objective-C, cocoa, mac app. I have a
I have a working rails app that uses imagemagick commands on my local mac
I have an app that needs to be run on MAC OS X 10.5,10.6,10.7
I have a mac app that uses tableView that has some rows.On taping(single tap

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.