Re: Image on TableView
Re: Image on TableView
- Subject: Re: Image on TableView
- From: Vincent Pottier <email@hidden>
- Date: Tue, 20 Jan 2004 20:01:40 +0100
Another way is to display a NSAttributedString in the TableView with a
drawAtPoint fonction instead of the imageView, try something like that:
- (void)aFonction
{
NSFileWrapper* wrapper =[[[NSFileWrapper alloc]
initRegularFileWithContents: [theImage
TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1]]
autorelease]; //theImage refere to the image you want to display
[wrapper setPreferredFilename:@"Name"];
NSAttributedString* representedImage = [NSAttributedString
attributedStringWithAttachment: [[[NSTextAttachment alloc]
initWithFileWrapper:wrapper] autorelease]];
[representedImage drawAtPoint:NSMakePoint(x,y)]; // where x et y is
the top left point of the represented string (in your case maybe half
table heigth, half table width)
}
To work properly, you can call aFonction when displaying a table
element:
if ([identifier isEqual:@"myIdentifier")
return [self aFonction];
That mean when no element is display, you have to display an empty one
and call aFonction.
In this sample the attributed string display only an image but you can
add what you want.
Hope that help
Vince
Le 20 janv. 04, ` 18:51, Michael Becker a icrit :
>
>> Is there any way of maybe making the imageview (or customview) not
>
>> respond to anything? So that the tableview thinks the imageview
>
>> wasn't
>
>> even there and still displays the focusring-border even when I drag
>
>> my
>
>> files on the imageview?
>
>
>
> Why not trying to derive a class from NSTableView and override
>
> drawRect:?
>
>
>
>
I think the NSTableCells will be drawn on top of the TableView's
>
drawRect output.
>
>
But it dawns on me that there is no "simple" way like "-
>
setRespondsToUserAction:NO" :-)
>
>
Michael
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.