<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5171478072766833605</id><updated>2026-10-23T07:08:57.851-07:00</updated><category term="iOS"/><category term="iPad"/><category term="iPhone"/><category term="Developer"/><category term="Development"/><category term="Documents"/><category term="NSAllDomainsMask .NSSystemDomainMask"/><category term="NSArray"/><category term="NSLocalDomainMask"/><category term="NSSearchPathForDirectoriesInDomains"/><category term="NSUserDomainMask"/><category term="UITextField"/><category term="UITextFieldDelegate"/><category term="cocoa"/><category term="directory"/><category term="field"/><category term="file"/><category term="hide"/><category term="keyboard"/><category term="objective c"/><category term="path"/><category term="resignFirstResponder"/><category term="text"/><category term="text field"/><category term="textFieldShouldReturn"/><title type='text'>iPhone Development Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://iphonedevelopmentblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5171478072766833605/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://iphonedevelopmentblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>David</name><uri>http://www.blogger.com/profile/06057925663147458299</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5171478072766833605.post-2320074684976693787</id><published>2011-03-13T16:57:00.000-07:00</published><updated>2011-03-14T11:12:18.087-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Developer"/><category scheme="http://www.blogger.com/atom/ns#" term="Development"/><category scheme="http://www.blogger.com/atom/ns#" term="directory"/><category scheme="http://www.blogger.com/atom/ns#" term="Documents"/><category scheme="http://www.blogger.com/atom/ns#" term="file"/><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><category scheme="http://www.blogger.com/atom/ns#" term="iPad"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="NSAllDomainsMask .NSSystemDomainMask"/><category scheme="http://www.blogger.com/atom/ns#" term="NSArray"/><category scheme="http://www.blogger.com/atom/ns#" term="NSLocalDomainMask"/><category scheme="http://www.blogger.com/atom/ns#" term="NSSearchPathForDirectoriesInDomains"/><category scheme="http://www.blogger.com/atom/ns#" term="NSUserDomainMask"/><category scheme="http://www.blogger.com/atom/ns#" term="path"/><title type='text'>Documents Directory File Path - iPhone, iPad, iOS Development</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;Getting the file path to the documents directory is very simple however the documentation in this area can be rather confusing.&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;Firstly you call the function NSSearchPathForDirectoriesInDomains().  This function returns an array however there will almost always only be one object within the array.&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;pre style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmxpAeAPKjpk3sGEVY2uApFEXtQAs2e93M7N2HGVR33AYX3ndMtb5nEB5N699JdKlyAE4iv9LP2jLNN5UQOwRKikm2_wluXk0HpOMWc6k5JENoB86YXflXzSuq0b9Gi_789GRcGJlgw93b/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; &lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC33CC;&quot;&gt;NSArray&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; * &lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;NSSearchPathForDirectoriesInDomains&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; (  &lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;NSSearchPathDirectory&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; directory,  &lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;NSSearchPathDomainMask&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; domainMask,  &lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC33CC;&quot;&gt;BOOL&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;color:#000000;word-wrap:normal;&quot;&gt; expandTilde );&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#999999;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;Lucida Grande&#39;, Geneva, Helvetica, Arial, sans-serif;&quot;&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;white-space: normal; font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;The reference for the method is shown above.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;The Directory value must be one of the predefined search path directories of the operating system. &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;The most commonly used directory and the one we&#39;ll use here is the documents directory which the value for is NSDocumentDirectory.  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#999999;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;Other values can be seen in the documentation&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#999999;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_DataTypes/Reference/reference.html%23//apple_ref/c/econst/NSApplicationDirectory&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;here&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#999999;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;white-space: normal; font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;The domain mask value is most often NSUserDomainMask meaning the returned path is local to the user&#39;s home directory.  Other possible values are shown below.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;NSUserDomainMask&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; - Local to the user&#39;s home directory.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;NSLocalDomainMask&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; - local to the current machine.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;NSNetworkDomainMask&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; - Publicly available location in the local area network.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;NSSystemDomainMask&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; - /System (Usually unused private).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;NSAllDomainsMask&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt; - will return a path for each of the above domains.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class=&quot;declaration&quot;   style=&quot;margin-top: 0px; margin-bottom: 1em; margin-right: 0.333em; margin-left: 0.5em; white-space: pre; font-family:Courier, Consolas, monospace;font-size:13px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#666666;&quot;&gt;The full example of how to obtain a string of the system file path to the user documents directory is shown below.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmxpAeAPKjpk3sGEVY2uApFEXtQAs2e93M7N2HGVR33AYX3ndMtb5nEB5N699JdKlyAE4iv9LP2jLNN5UQOwRKikm2_wluXk0HpOMWc6k5JENoB86YXflXzSuq0b9Gi_789GRcGJlgw93b/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code  style=&quot;word-wrap:normal;color:#000000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; -(&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC33CC;&quot;&gt;NSString&lt;/span&gt; *)documentsDirectoryPath {&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;      &lt;/span&gt;NSArray&lt;/span&gt; *paths = &lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;NSSearchPathForDirectoriesInDomains&lt;/span&gt;(&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;NSDocumentDirectory&lt;/span&gt;, &lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;NSUserDomainMask&lt;/span&gt;, &lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC33CC;&quot;&gt;YES&lt;/span&gt;);&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;      &lt;/span&gt;NSString&lt;/span&gt; *documentsDirectoryPath = [paths &lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;objectAtIndex&lt;/span&gt;:&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#3333FF;&quot;&gt;0&lt;/span&gt;];&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC33CC;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;      &lt;/span&gt;return&lt;/span&gt; documentsDirectoryPath;&lt;br /&gt;}  &lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphonedevelopmentblog.blogspot.com/feeds/2320074684976693787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphonedevelopmentblog.blogspot.com/2011/03/documents-directory-file-path-iphone.html#comment-form' title='217 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5171478072766833605/posts/default/2320074684976693787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5171478072766833605/posts/default/2320074684976693787'/><link rel='alternate' type='text/html' href='http://iphonedevelopmentblog.blogspot.com/2011/03/documents-directory-file-path-iphone.html' title='Documents Directory File Path - iPhone, iPad, iOS Development'/><author><name>David</name><uri>http://www.blogger.com/profile/06057925663147458299</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>217</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5171478072766833605.post-9210829828529067726</id><published>2011-03-13T16:01:00.000-07:00</published><updated>2011-03-14T11:03:55.275-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cocoa"/><category scheme="http://www.blogger.com/atom/ns#" term="field"/><category scheme="http://www.blogger.com/atom/ns#" term="hide"/><category scheme="http://www.blogger.com/atom/ns#" term="iOS"/><category scheme="http://www.blogger.com/atom/ns#" term="iPad"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="keyboard"/><category scheme="http://www.blogger.com/atom/ns#" term="objective c"/><category scheme="http://www.blogger.com/atom/ns#" term="resignFirstResponder"/><category scheme="http://www.blogger.com/atom/ns#" term="text"/><category scheme="http://www.blogger.com/atom/ns#" term="text field"/><category scheme="http://www.blogger.com/atom/ns#" term="textFieldShouldReturn"/><category scheme="http://www.blogger.com/atom/ns#" term="UITextField"/><category scheme="http://www.blogger.com/atom/ns#" term="UITextFieldDelegate"/><title type='text'>Hide Keyboard on Text Field Return - iPhone, iPad, iOS Development</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;One of the most asked question&#39;s by new iPhone developers is how to hide the keyboard.  This is certainly one of the most lacking area&#39;s of the documentation for a budding iPhone developer.&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;To programatically hide the keyboard you must call the method &lt;a href=&quot;http://developer.apple.com/library/ios/documentation/uikit/reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/resignFirstResponder&quot;&gt;resignFirstResponder&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#3366FF;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;on your text field or text view.  This can be called from anywhere however it is most commonly from a done button or from the keyboard return key being pressed.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre style=&quot;font-family: arial; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dashed; border-right-style: dashed; border-bottom-style: dashed; border-left-style: dashed; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); width: 99%; height: auto; overflow-x: auto; overflow-y: auto; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(240, 240, 240); background-image: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmxpAeAPKjpk3sGEVY2uApFEXtQAs2e93M7N2HGVR33AYX3ndMtb5nEB5N699JdKlyAE4iv9LP2jLNN5UQOwRKikm2_wluXk0HpOMWc6k5JENoB86YXflXzSuq0b9Gi_789GRcGJlgw93b/s320/codebg.gif); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(0, 0, 0); text-align: left; line-height: 20px; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;code  style=&quot;word-wrap:normal;color:#000000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;  [&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC33CC;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;textField&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;resignFirstResponder&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;];&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; line-height: 21px; white-space: pre;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:Georgia, serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot; line-height: normal; white-space: normal;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;To hide the keyboard when the return key is pressed you must add a listener to the text field (&lt;a href=&quot;http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextField_Class/Reference/UITextField.html&quot;&gt;UITextField&lt;/a&gt;) delegate method.  &lt;a href=&quot;http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html&quot;&gt;UITextfieldDelegate&lt;/a&gt; protocol contains a method called &lt;a href=&quot;http://developer.apple.com/library/ios/documentation/uikit/reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html#//apple_ref/occ/intfm/UITextFieldDelegate/textFieldShouldReturn:&quot;&gt;textFieldShouldReturn&lt;/a&gt;, This method is called to determine if the text field should process the pressing of the return key.  You can call your &lt;a href=&quot;http://developer.apple.com/library/ios/documentation/uikit/reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/instm/UIResponder/resignFirstResponder&quot;&gt;resignFirstResponder&lt;/a&gt; on the text field from within this method to hide the keyboard when pressed.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre style=&quot;font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmxpAeAPKjpk3sGEVY2uApFEXtQAs2e93M7N2HGVR33AYX3ndMtb5nEB5N699JdKlyAE4iv9LP2jLNN5UQOwRKikm2_wluXk0HpOMWc6k5JENoB86YXflXzSuq0b9Gi_789GRcGJlgw93b/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;&quot;&gt;&lt;code  style=&quot;word-wrap:normal;color:#000000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; - (&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC33CC;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;BOOL&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code  style=&quot;word-wrap:normal;color:#000000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;)textFieldShouldReturn:(&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC33CC;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;UITextField&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code  style=&quot;word-wrap:normal;color:#000000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; *)textField {&lt;br /&gt;[&lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#CC66CC;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;textField&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code  style=&quot;word-wrap:normal;color:#000000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;code style=&quot;word-wrap: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#6600CC;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;resignFirstResponder&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;code  style=&quot;word-wrap:normal;color:#000000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;];&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;br /&gt;If this doesn&#39;t appear to be working for you make sure you&#39;ve remembered to set the delegate property on the textField.  &lt;/span&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;If you have any problems feel free to post in the comment&#39;s ;)&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://iphonedevelopmentblog.blogspot.com/feeds/9210829828529067726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://iphonedevelopmentblog.blogspot.com/2011/03/hide-keyboard-on-text-field-return.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5171478072766833605/posts/default/9210829828529067726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5171478072766833605/posts/default/9210829828529067726'/><link rel='alternate' type='text/html' href='http://iphonedevelopmentblog.blogspot.com/2011/03/hide-keyboard-on-text-field-return.html' title='Hide Keyboard on Text Field Return - iPhone, iPad, iOS Development'/><author><name>David</name><uri>http://www.blogger.com/profile/06057925663147458299</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry></feed>