<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>toxicsoftware.com &#187; NSAttributedString</title>
	<atom:link href="http://toxicsoftware.com/tag/nsattributedstring/feed/" rel="self" type="application/rss+xml" />
	<link>http://toxicsoftware.com</link>
	<description>RANDOMIZE USR 0</description>
	<lastBuildDate>Sun, 01 Aug 2010 17:49:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Cocoa: Fetching all attachments from an NSAttributedString</title>
		<link>http://toxicsoftware.com/cocoa_fetching_all_attachments_from_an_nsattributedstring/</link>
		<comments>http://toxicsoftware.com/cocoa_fetching_all_attachments_from_an_nsattributedstring/#comments</comments>
		<pubDate>Thu, 27 Nov 2003 18:57:41 +0000</pubDate>
		<dc:creator>schwa</dc:creator>
				<category><![CDATA[Default]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[NSAttributedString]]></category>
		<category><![CDATA[Source Code]]></category>

		<guid isPermaLink="false">http://toxicsoftware.com/cocoa_fetching_all_attachments_from_an_nsattributedstring/</guid>
		<description><![CDATA[This code snippet is a category of NSAttributedString that shows how to fetch all attachments from the string. Header: @interface NSAttributedString (NSAttributedString_MoreExtensions) /** * @method allAttachments * @abstract Fetchs all attachments from an NSAttributedString. * @discussion This method searchs for &#8230; <a href="http://toxicsoftware.com/cocoa_fetching_all_attachments_from_an_nsattributedstring/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This code snippet is a category of NSAttributedString that shows how to fetch all attachments from the string.</p>

<p>Header:</p>

<pre><code>@interface NSAttributedString (NSAttributedString_MoreExtensions)

/** 
 * @method allAttachments 
 * @abstract Fetchs all attachments from an NSAttributedString. 
 * @discussion This method searchs for NSAttachmentAttributeName attributes within the string instead of searching for NSAttachmentCharacter characters. 
 */
- (NSArray *)allAttachments;

@end
</code></pre>

<p>Source:</p>

<pre><code>@implementation NSAttributedString (NSAttributedString_MoreExtensions)
- (NSArray *)allAttachments
{
NSMutableArray *theAttachments = [NSMutableArray array];
NSRange theStringRange = NSMakeRange(0, [self length]);
if (theStringRange.length &gt; 0)
    {
    unsigned N = 0;
    do
        {
        NSRange theEffectiveRange;
        NSDictionary *theAttributes = [self attributesAtIndex:N longestEffectiveRange:&amp;theEffectiveRange inRange:theStringRange];
        NSTextAttachment *theAttachment = [theAttributes objectForKey:NSAttachmentAttributeName];
        if (theAttachment != NULL)
            [theAttachments addObject:theAttachment];
        N = theEffectiveRange.location + theEffectiveRange.length;
        }
    while (N &lt; theStringRange.length);
    }
return(theAttachments);
}

@end
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://toxicsoftware.com/cocoa_fetching_all_attachments_from_an_nsattributedstring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
