<?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>KevFoo &#187; Uniform Type</title>
	<atom:link href="http://blog.kevfoo.com/index.php/tag/uniform-type/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kevfoo.com</link>
	<description>The weblog of a Chicago based .Net and iPhone developer.</description>
	<lastBuildDate>Wed, 26 May 2010 13:33:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Monotouch Quickie : UIPasteboard Snippet</title>
		<link>http://blog.kevfoo.com/index.php/2010/01/monotouch-quickie-uipasteboard-snippet/</link>
		<comments>http://blog.kevfoo.com/index.php/2010/01/monotouch-quickie-uipasteboard-snippet/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 14:30:10 +0000</pubDate>
		<dc:creator>Kevin McMahon</dc:creator>
				<category><![CDATA[UIPasteboard]]></category>
		<category><![CDATA[monotouch]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Copy And Paste]]></category>
		<category><![CDATA[Docs]]></category>
		<category><![CDATA[Good Measure]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Png]]></category>
		<category><![CDATA[Public Url]]></category>
		<category><![CDATA[Text String]]></category>
		<category><![CDATA[Uniform Type]]></category>
		<category><![CDATA[Uti]]></category>
		<category><![CDATA[Utis]]></category>

		<guid isPermaLink="false">http://blog.kevfoo.com/index.php/2010/01/monotouch-quickie-uipasteboard-snippet/</guid>
		<description><![CDATA[Came across the need to plop a string onto the clipboard (aka UIPasteboard) programatically last night and hit up the MonoTouch docs to see what was involved.&#160; It wasn’t readily apparent what would work for the string expected to be passed as the SetValue method pasteboardType argument.&#160; Turns out, after digging into the official Apple [...]]]></description>
			<content:encoded><![CDATA[<p>Came across the need to plop a string onto the clipboard (aka <a href="http://go-mono.com/docs/monodoc.ashx?link=T%3aMonoTouch.UIKit.UIPasteboard">UIPasteboard</a>) programatically last night and hit up the MonoTouch docs to see what was involved.&#160; It wasn’t readily apparent what would work for the string expected to be passed as the SetValue method pasteboardType argument.&#160; Turns out, after digging into the official Apple docs, the string you need to provide is the Uniform Type Identifier (UTI) that corresponds to the data type being passed (in my case “public.utf8-plain-text”).&#160; For my future reference (always seems to take longer to find things at the iPhone doc site) here is a table of the relevant UTIs that might come in handy in the future.</p>
<table border="0" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="200">string</td>
<td valign="top" width="200">public.utf8-plain-text</td>
</tr>
<tr>
<td valign="top" width="200">JPEG</td>
<td valign="top" width="200">public.jpeg</td>
</tr>
<tr>
<td valign="top" width="200">PNG</td>
<td valign="top" width="200">public.png</td>
</tr>
<tr>
<td valign="top" width="200">Url</td>
<td valign="top" width="200">public.url</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p>And for good measure here is a snippet that shows putting a string on the general clipboard and reading it off.</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:1d9e99c4-fe17-4d21-b71d-52e548770074" class="wlWriterEditableSmartContent">
<pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;overflow: auto;"><span style="color: #0000FF;">string</span><span style="color: #000000;"> clipboardText </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #800000;">"</span><span style="color: #800000;">Copy and Paste Me!</span><span style="color: #800000;">"</span><span style="color: #000000;">;

UIPasteboard.General.SetValue(clipboardText,
</span><span style="color: #800000;">"</span><span style="color: #800000;">public.utf8-plain-text</span><span style="color: #800000;">"</span><span style="color: #000000;">);
</span><span style="color: #0000FF;">string</span><span style="color: #000000;"> actualClipboardText </span><span style="color: #000000;">=</span><span style="color: #000000;"> UIPasteboard.General.GetValue(</span><span style="color: #800000;">"</span><span style="color: #800000;">public.utf8-plain-text</span><span style="color: #800000;">"</span><span style="color: #000000;">);

Assert.AreSame( clipboardText, actualClipboardText.ToString());</span></pre>
<p><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --></div>
</p>
<p>Enjoy.</p>
<p><em>[Updated(1/30/2010): Replaced NSStrings out with strings]</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kevfoo.com/index.php/2010/01/monotouch-quickie-uipasteboard-snippet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
