NSTextAttachmentCell & cellbaselineoffset
NSTextAttachmentCell & cellbaselineoffset
- Subject: NSTextAttachmentCell & cellbaselineoffset
- From: Carl Johan Foss <email@hidden>
- Date: Sun, 26 Nov 2006 13:36:41 +0100
Hi,
Would appreciate if someone could help a newbie to construct an
NSAttributedString with a an attachment (image) which is placed at a
certain place next to my string, which will then be placed in a
NSTableView. As far as I have read from the forum I should use
cellbaselineoffset, but I would really appreciate if someone can give
me a concrete example since I have not been able to solve this for a
while now.
Here is part of my code so far which of course does not seem to work:
- (NSPoint)cellBaselineOffset
{
NSPoint p = NSMakePoint(0.0, -20.0);
return p;
}
- (void)setHistoryData:(NSAttributedString *)st
{
NSTextAttachment *attachment;
NSTextAttachmentCell *xCell;
xCell = [[NSTextAttachmentCell alloc] init];
[xCell setImage:[NSImage imageNamed:@"error.png"]];
[xCell cellBaselineOffset];
attachment = [[NSTextAttachment alloc] init];
[attachment setAttachmentCell:xCell];
NSAttributedString *pic = [NSAttributedString
attributedStringWithAttachment:attachment];
finalString = [[[NSMutableAttributedString alloc]
initWithAttributedString:pic] autorelease];
[finalString appendAttributedString:st];
.......
}
_______________________________________________
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