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 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

I want to change a outline view , and add checkbox cell in front
How would I do this? The Outline View is being used with Core Data.
To outline: I have a parser that grabs Cell references using the following regex
How can I cause Eclipse's Outline view to do any of the following when
I need to implement a 1 level outline view out of UITableView. The cells
I'm wondering how one would implement an outline view like the one Xcode 3
Using Aptana Studio 3.0.6 I can't find any way to view/outline/explore the hierarchy of
I have a complex custom view - photo collage. What is observed is whenever
i'm trying to get a Outline view to display a directory, now I've edited
I am building my App after adding some code but I get the Un-Recongnized

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.