• 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
NSTextAttachmentCell & cellbaselineoffset
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Opening a specific helppage with openHelpAnchor
  • Next by Date: Re: Cocoa-dev Digest, Vol 3, Issue 1396
  • Previous by thread: Re: App crashes at startup for Standard user accounts
  • Next by thread: Re: Cocoa-dev Digest, Vol 3, Issue 1396
  • Index(es):
    • Date
    • Thread