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

  • Home
  • SEARCH
  • 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 3962790
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:08:17+00:00 2026-05-20T03:08:17+00:00

I my outline view, i am adding Custom cell, To drawing custom cell, i

  • 0

I my outline view, i am adding Custom cell, To drawing custom cell, i am referring example code , present in the Cocoa documentation

http://www.martinkahr.com/2007/05/04/nscell-image-and-text-sample/

I want to change the disclosure image of the cell with my custom image, i have tried following things

- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item 
    {
        if([item isKindOfClass:[NSValue class]])
        {
            MyData *pDt = (MyData *)[item pointerValue];
            if(pDt->isGroupElement())
            {
                [cell setImage:pGroupImage];
            }
        }
}

but that too not working, Is there any other way to change the disclosure image,
also how can i find out in willDisplayCell whether Item is expand or collapse, so i can set the image accordingly,

Is this only the place to change the disclosure image ?

  • 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-05-20T03:08:18+00:00Added an answer on May 20, 2026 at 3:08 am

    You’ve got the basic idea but what you will need to do is draw the image yourself. Here’s the code I use:

    - (void)outlineView:(NSOutlineView *)outlineView willDisplayOutlineCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
        NSString *theImageName;
        NSInteger theCellValue = [cell integerValue];
        if (theCellValue==1) {
            theImageName = @"PMOutlineCellOn";
        } else if (theCellValue==0) {
            theImageName = @"PMOutlineCellOff";
        } else {
            theImageName = @"PMOutlineCellMixed";
        }
    
        NSImage *theImage = [NSImage imageNamed: theImageName];
        NSRect theFrame = [outlineView frameOfOutlineCellAtRow:[outlineView rowForItem: item]];
        theFrame.origin.y = theFrame.origin.y +17;
        // adjust theFrame here to position your image
        [theImage compositeToPoint: theFrame.origin operation:NSCompositeSourceOver];
        [cell setImagePosition: NSNoImage];
    }
    

    You will need 3 different images as you can see, one for the ON state, one for the OFF state and also one for the MIXED state which should be halfway between the two. The mixed state makes sure you still get the opening and closing animation.

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

Sidebar

Related Questions

Can someone tell me if this is a bug in the SDK/IDE: Any custom
Im developing a website about travels. My needs is to build a view that
Sorry if this seems like a silly question - I am an amateur when
I would like to be able to group similar methods and have them appear
This kind of stuff exists in Eclipse: But I've not found it in Visual
I've been considering how you would write a business application in only F# with
On my home page, I have four boxes, and when you click on them,
So given: CREATE TABLE stuff ( really_long_title int(10) NO NULL auto_increment, really_long_title_number_1 varchar(10) NO
I know the question of session management has been brought up in the past,
In my django admin section, I'd like to show different versions of the admin

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.