• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying 2 images in a single cell of nstableview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying 2 images in a single cell of nstableview


  • Subject: Re: Displaying 2 images in a single cell of nstableview
  • From: Ronny Reichmann <email@hidden>
  • Date: Thu, 7 Dec 2006 16:15:18 +0100

Hello,

my idea of solving this problem is as follows:

First of all: create a NSView subclass that is able to draw your images both (next to each other or like you want) - of course inside the drawRect: method. Then draw these view to an image. If you don't know how to do this - here is how:

Create a offscreen window programmatically:

NSWindow *hiddenWindow = [[NSWindow alloc]
	initWithContentRect:
	NSMakeRect( -1000,-1000,width,height )
	styleMask: NSTitledWindowMask|NSClosableWindowMask
	backing:NSBackingStoreNonretained
	defer:NO];

Add your custom view to the window:

[[hiddenWindow contentView] addSubview:myCustomView];

Then do the following:

NSBitmapImageRep *rep = [button bitmapImageRepForCachingDisplayInRect:»the bounds of your images«];
[myCustomView cacheDisplayInRect:»the bounds of your images« toBitmapImageRep:rep];
NSImage *resultImage = [[[NSImage alloc] init] autorelease];
[resultImage addRepresentation:rep];


Now you can add the » resultImage« to your cell. This will work since 10.4. There is another way described in the cocoa documentation that works for pre 10.4 systems, but does only draw without alpha (alpha areas of your images will show the window background). This way looks something like that:

[myCustomView lockFocus];
NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:»the bounds of your images«] autorelease];
[myCustomView unlockFocus];
NSImage * resultImage = [[[NSImage alloc] init] autorelease];
[resultImage addRepresentation:rep];




I hope I could help you,

ron





Am 07.12.2006 um 15:18 schrieb vibhatha v:

Hi,

i have to display 2 images in a single cell of an nstableview.
To display 1 image i am using tableview willdisplay cell function.

Any suggestions as to how can display 2 images in a single table cell?

Thanks and Regards,
Vibhatha.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Displaying 2 images in a single cell of nstableview
      • From: Trygve Inda <email@hidden>
References: 
 >Displaying 2 images in a single cell of nstableview (From: "vibhatha v" <email@hidden>)

  • Prev by Date: Re: Core Data, using refreshObject:mergeChanges: to trim a portion of my object graph and regain memory... PLEASE HELP!!!!!!!
  • Next by Date: Re: Displaying 2 images in a single cell of nstableview
  • Previous by thread: Displaying 2 images in a single cell of nstableview
  • Next by thread: Re: Displaying 2 images in a single cell of nstableview
  • Index(es):
    • Date
    • Thread