<?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-7206505437889765133</id><updated>2024-10-25T13:30:12.469+09:00</updated><category term="Snippet"/><category term="NSDictionary"/><category term="Bitly"/><category term="Category"/><category term="JSON"/><category term="Mac"/><category term="Mavericks"/><category term="NSString"/><category term="NSXMLParser"/><category term="OS"/><category term="UIDevice"/><category term="VirtualBox"/><category term="JavaScript"/><category term="KeyRemap4MacBook"/><category term="NSArray"/><category term="NSCountedSet"/><category term="NSNotificationCenter"/><category term="NSUserDefaults"/><category term="PropertyList"/><category term="Screenshot"/><category term="UIButton"/><category term="UIImage"/><category term="UIImageView"/><category term="UITableView"/><category term="UITableViewCell"/><category term="UITapGestureRecognizer"/><category term="zip"/><category term="ターミナル"/><title type='text'>7bunnies blog</title><subtitle type='html'>iOSアプリ開発の活動報告やそれにまつわる雑感など</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-1393051048574203578</id><published>2013-10-30T14:21:00.005+09:00</published><updated>2013-10-30T14:23:49.434+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mac"/><category scheme="http://www.blogger.com/atom/ns#" term="Mavericks"/><category scheme="http://www.blogger.com/atom/ns#" term="OS"/><category scheme="http://www.blogger.com/atom/ns#" term="VirtualBox"/><title type='text'>MacOS X MavericksのVirtualBoxでWIndows 7が起動しない時の対処法</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8kV4QtH2uGwJ63tb_ud5fpiBp2voB7tRB1kfZFaEtlW75hWI0WakTVJwbMtou1QwbznYP5bUiCuVd89CXBVgwc1ED6EORM9PjWYwhWOtuaYcBeu9v7fKOgEQvdkgfaZ2nzOkED4WKd2w/s1600/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88+2013-10-30+14.08.56.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;137&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8kV4QtH2uGwJ63tb_ud5fpiBp2voB7tRB1kfZFaEtlW75hWI0WakTVJwbMtou1QwbznYP5bUiCuVd89CXBVgwc1ED6EORM9PjWYwhWOtuaYcBeu9v7fKOgEQvdkgfaZ2nzOkED4WKd2w/s320/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88+2013-10-30+14.08.56.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kernel driver not installed (rc=1908)&lt;br /&gt;
Make sure the kernel module has been loaded successfully.&lt;br /&gt;
&lt;br /&gt;
というエラーポップアップでVirtualBoxにインストールしているWindows 7が起動しない。しかもMacOS本体を立ち上げ直すたびに再現するようで困っている。。&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvXc5QZiGaX1H_NgVJAwzCVO6MjapUECnH3FyqfBsA9tAKeDca8gcYzVYGnuUbRtlrESehVXXrHDg-rXL8Au_a_gOvtSWI79uRyCemAiMJ5h7O7xh1DD135s1tzU5AkMBn7hqr5THrgRg/s1600/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88+2013-10-30+14.09.28.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;266&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvXc5QZiGaX1H_NgVJAwzCVO6MjapUECnH3FyqfBsA9tAKeDca8gcYzVYGnuUbRtlrESehVXXrHDg-rXL8Au_a_gOvtSWI79uRyCemAiMJ5h7O7xh1DD135s1tzU5AkMBn7hqr5THrgRg/s320/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88+2013-10-30+14.09.28.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
この画面が立ち上がってしまうと普通に終了できなくなるのでアクティビティモニタからVirtualBoxを選んで強制終了するしかない。&lt;br /&gt;
&lt;br /&gt;
この問題の対処法はVirtualBoxの再インストール、VirtualBoxをきちんと終了させてから行おう。&lt;br /&gt;
VirtualBoxのインストールはたまに失敗してファイルが破損したりして、バックアップがないと悲惨なことになる可能性があるので、注意してオペレーションして下さい。&lt;br /&gt;
インストールが正常に完了すればMacを再起動しなくても立ち上がると思う。</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/1393051048574203578/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2013/10/macosx-mavericksvirtualboxwindows-7.html#comment-form' title='1 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1393051048574203578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1393051048574203578'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2013/10/macosx-mavericksvirtualboxwindows-7.html' title='MacOS X MavericksのVirtualBoxでWIndows 7が起動しない時の対処法'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8kV4QtH2uGwJ63tb_ud5fpiBp2voB7tRB1kfZFaEtlW75hWI0WakTVJwbMtou1QwbznYP5bUiCuVd89CXBVgwc1ED6EORM9PjWYwhWOtuaYcBeu9v7fKOgEQvdkgfaZ2nzOkED4WKd2w/s72-c/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88+2013-10-30+14.08.56.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-3544187346781542935</id><published>2013-10-24T14:59:00.000+09:00</published><updated>2013-10-24T15:11:42.961+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mac"/><category scheme="http://www.blogger.com/atom/ns#" term="Mavericks"/><category scheme="http://www.blogger.com/atom/ns#" term="OS"/><category scheme="http://www.blogger.com/atom/ns#" term="VirtualBox"/><title type='text'>MacOS X MavericksにしたらVirtualBoxがおかしくなった時の対処法</title><content type='html'>&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;Mac OS X MavericksにしたらVirtualBoxがおかしくなったので対処した方法を書いておきます。&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;事象&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;ホストオンリーアダプタが無効になり、ホストからゲストOSへSSHが出来なくなった。&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;対処&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;VirtualBox 4.3をインストールする。&lt;/span&gt;&lt;br /&gt;
&lt;a href=&quot;https://www.virtualbox.org/wiki/Downloads&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;https://www.virtualbox.org/wiki/Downloads&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;2013/10/23時点、初回のtryで開発元が認証できないエラーが出てインストールできなかったが、2013/10/24にretryしたら正常にインストールできた。&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;インストールに失敗すると、アプリケーションとしてのVirtualBoxファイルが破損して起動できなくなったりするので厳重注意！&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;既存のアプリケーションフォルダとVirtualBox VMディレクトリをrenameしてからインストールを行うと失敗した場合手軽に復元できるのでよい。&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;VirtualBox VMディレクトリはサイズが大きいと思うのでコピペはお勧めできない。&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;通常ユーザーディレクトリ直下に作成されるVirtualBox VMディレクトリは当然引き継げるので、挙動が変になった時に設定をいじったり、消したりしないように。&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;VirtualBox 4.3 Oracle VM VirtualBox Extension Pack&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;a href=&quot;https://www.virtualbox.org/wiki/Downloads&quot;&gt;https://www.virtualbox.org/wiki/Downloads&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
こちらも併せてダウンロードしておくと良い。&lt;/div&gt;
&lt;div&gt;
ダウンロードしたらVirtualBox VM直下などに保存して、&lt;/div&gt;
&lt;div&gt;
VirtualBox &amp;gt; 環境設定 &amp;gt; 機能拡張にある拡張パッケージとして追加する。&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
4.3では、ゲストOSの画面リサイズが自動で出来るようになっている反面、マルチディスプレイ対応で画面上部にメニューバーがある都合上、ゲストOSの画面をフルスクリーンで表示すると画面下部が見切れたりする。&lt;/div&gt;
&lt;div&gt;
スケールモードでなんとかなる。&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/3544187346781542935/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2013/10/macos-x-mavericksvirtualbox.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/3544187346781542935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/3544187346781542935'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2013/10/macos-x-mavericksvirtualbox.html' title='MacOS X MavericksにしたらVirtualBoxがおかしくなった時の対処法'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-4248823769863836478</id><published>2012-10-14T22:02:00.002+09:00</published><updated>2012-10-14T22:03:18.607+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="KeyRemap4MacBook"/><title type='text'>KeyRemap4MacBookの設定方法</title><content type='html'>MacBookProを使っているのだが、コードを書く際に&lt;br /&gt;
矢印キーが押しにくいのでKeyRemap4MacBookを使って&lt;br /&gt;
以下のようにRemapした。&lt;br /&gt;
&lt;br /&gt;
↑はControl-L + I&lt;br /&gt;
↓はControl-L + K&lt;br /&gt;
←はControl-L + J&lt;br /&gt;
→はControl-L + L&lt;br /&gt;
&lt;br /&gt;
ついでにHOMEとENDもそれぞれRemapした。&lt;br /&gt;
&lt;br /&gt;
HOMEはControl-L + A&lt;br /&gt;
ENDはControl-L + E&lt;br /&gt;
&lt;br /&gt;
まずはKeyRemap4MacBookを&lt;a href=&quot;http://pqrs.org/macosx/keyremap4macbook/index.html.ja&quot; target=&quot;_blank&quot;&gt;インストール&lt;/a&gt;する。&lt;br /&gt;
つぎにリファレンスを&lt;a href=&quot;http://pqrs.org/macosx/keyremap4macbook/xml-basic.html.ja&quot; target=&quot;_blank&quot;&gt;一読&lt;/a&gt;する。&lt;br /&gt;
最後に私が設定しているprivate.xmlを貼ります。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;root&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;name&amp;gt;CUSTOM_CURSOR_UP&amp;lt;/name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;identifier&amp;gt;CUSTOM_CURSOR_UP&amp;lt;/identifier&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;--KeyToKey--&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::I, ModifierFlag::CONTROL_L,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::CURSOR_UP&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;name&amp;gt;CUSTOM_CURSOR_DOWN&amp;lt;/name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;identifier&amp;gt;CUSTOM_CURSOR_DOWN&amp;lt;/identifier&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;--KeyToKey--&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::K, ModifierFlag::CONTROL_L,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::CURSOR_DOWN&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;name&amp;gt;CUSTOM_CURSOR_LEFT&amp;lt;/name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;identifier&amp;gt;CUSTOM_CURSOR_LEFT&amp;lt;/identifier&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;--KeyToKey--&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::J, ModifierFlag::CONTROL_L,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::CURSOR_LEFT&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;name&amp;gt;CUSTOM_CURSOR_RIGHT&amp;lt;/name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;identifier&amp;gt;CUSTOM_CURSOR_RIGHT&amp;lt;/identifier&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;--KeyToKey--&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::L, ModifierFlag::CONTROL_L,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::CURSOR_RIGHT&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;name&amp;gt;CUSTOM_HOME&amp;lt;/name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;identifier&amp;gt;CUSTOM_HOME&amp;lt;/identifier&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;--KeyToKey--&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::A, ModifierFlag::CONTROL_L,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::HOME&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;item&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;name&amp;gt;CUSTOM_END&amp;lt;/name&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;identifier&amp;gt;CUSTOM_END&amp;lt;/identifier&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;--KeyToKey--&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::E, ModifierFlag::CONTROL_L,&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;KeyCode::END&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&amp;lt;/autogen&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/item&amp;gt;&lt;br /&gt;
&amp;lt;/root&amp;gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/4248823769863836478/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2012/10/keyremap4macbook.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/4248823769863836478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/4248823769863836478'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2012/10/keyremap4macbook.html' title='KeyRemap4MacBookの設定方法'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-1477752151519168547</id><published>2012-04-17T17:49:00.002+09:00</published><updated>2012-04-17T17:51:56.616+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><title type='text'>JavaScriptで数値の配列をソートする</title><content type='html'>&lt;code&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;Array.prototype.sortNumbers = function (op) {&lt;/code&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;if (op || 0) {&lt;/span&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//降順ソート&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return this.sort(function(a,b){&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return b - a;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;});&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} else {&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;//昇順ソート&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return this.sort(function(a,b){&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;return a - b;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;});&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;}&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;/*&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;var arr = [1,15,3,8,24];&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;alert(arr.sortNumbers());&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;*/&lt;/code&gt;&lt;br /&gt;
&lt;code&gt; &lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/1477752151519168547/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2012/04/javascript.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1477752151519168547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1477752151519168547'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2012/04/javascript.html' title='JavaScriptで数値の配列をソートする'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-7090184477333599234</id><published>2012-01-23T01:27:00.000+09:00</published><updated>2012-01-23T01:27:31.395+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="zip"/><category scheme="http://www.blogger.com/atom/ns#" term="ターミナル"/><title type='text'>Mac OS Xでパスワード付きzipファイルを作る方法</title><content type='html'>ターミナルで対象ファイルのzipファイルを作成して、パスワードを付けるという流れで作成する。&lt;br /&gt;
&lt;br /&gt;
１．ターミナルで対象ファイルがある場所まで移動（例：tarouのDesktopにあるhoge.pdf）&lt;br /&gt;
$ cd /Users/tarou/Desktop/&lt;br /&gt;
&lt;br /&gt;
２．zipファイルの作成（例：hoge.zipという名前のzipファイルを作成）&lt;br /&gt;
$ zip hoge.zip hoge.pdf&lt;br /&gt;
&lt;br /&gt;
３．作成したzipファイルにパスワードを付与（例：パスワードをpassとした場合）&lt;br /&gt;
$ zipcloak hoge.zip&lt;br /&gt;
Enter password: pass&lt;br /&gt;
Verify password: pass&lt;br /&gt;
&lt;br /&gt;
以上、３ステップです。</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/7090184477333599234/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2012/01/mac-os-xzip.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7090184477333599234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7090184477333599234'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2012/01/mac-os-xzip.html' title='Mac OS Xでパスワード付きzipファイルを作る方法'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-7027706723791068583</id><published>2012-01-10T02:31:00.000+09:00</published><updated>2012-01-10T02:31:04.915+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Screenshot"/><title type='text'>iOSシミュレータの画面をスクリーンショットする方法</title><content type='html'>&lt;div&gt;iOSアプリ画面のスクリーンショットは起動画像やスタートガイドなので&lt;/div&gt;&lt;div&gt;よく使われる。実機の画面をコピーしてもよいが、iOSシミュレータの画面を&lt;/div&gt;&lt;div&gt;使うほうが勝手が良い。&lt;/div&gt;&lt;div&gt;なぜなら、iOSシミュレータのデバイスを切り替えることで、Retinaのそれも&lt;/div&gt;&lt;div&gt;コピー出来るからだ。&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Ctrl+Cmd+Cで画面コピー（メニューからも可能）&lt;/li&gt;
&lt;li&gt;プレビュー.appを起動&lt;/li&gt;
&lt;li&gt;Cmd+Nでコピー画像を貼り付ける。&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;以上の手順で作成する。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;iPhoneのLaunch名：Default.png&lt;/div&gt;&lt;div&gt;iPhone(Retina)のLaunch名：Default@2x.png&lt;/div&gt;&lt;div&gt;iPad(Portrait)のLaunch名：Default-Portrait~ipad.png&lt;/div&gt;&lt;div&gt;iPad(Landscape)のLaunch名：Default-Landscape~ipad.png&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Launch画像を作る上で注意すべきはiPadの画面サイズ&lt;/div&gt;&lt;div&gt;コピーされた画像は768×1024なので、これを&lt;/div&gt;&lt;div&gt;748×1024と1004×768にしなければならない。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Photoshopなどで加工しよう。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/7027706723791068583/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2012/01/ios.html#comment-form' title='1 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7027706723791068583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7027706723791068583'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2012/01/ios.html' title='iOSシミュレータの画面をスクリーンショットする方法'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-3306328368507946269</id><published>2011-09-26T14:43:00.000+09:00</published><updated>2011-09-26T14:43:27.900+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Snippet"/><category scheme="http://www.blogger.com/atom/ns#" term="UIDevice"/><title type='text'>iOSデバイスを判定するSnippet</title><content type='html'>主にiPadなのかそれ以外なのかを判定するのに使っている。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;BOOL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; isPad = [[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIDevice&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;currentDevice&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;userInterfaceIdiom&lt;span style=&quot;color: black;&quot;&gt;] == &lt;/span&gt;UIUserInterfaceIdiomPad&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (isPad) {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;読み込むnibファイルを切り替えたり&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *nibName = [[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIDevice&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;currentDevice&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;userInterfaceIdiom&lt;span style=&quot;color: black;&quot;&gt;] == &lt;/span&gt;UIUserInterfaceIdiomPad&lt;span style=&quot;color: black;&quot;&gt; ? &lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;viewController_iPad&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; : &lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;viewController_iPhone&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIViewController&lt;/span&gt; *viewController = [[&lt;span style=&quot;color: #7340a3;&quot;&gt;UIViewController&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;alloc&lt;/span&gt;]&lt;span style=&quot;color: #3f217c;&quot;&gt;initWithNibName&lt;/span&gt;:nibName &lt;span style=&quot;color: #3f217c;&quot;&gt;bundle&lt;/span&gt;:&lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;];&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/3306328368507946269/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/iossnippet_26.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/3306328368507946269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/3306328368507946269'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/iossnippet_26.html' title='iOSデバイスを判定するSnippet'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-7037266890638674416</id><published>2011-09-26T14:21:00.003+09:00</published><updated>2011-09-26T14:25:19.170+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bitly"/><category scheme="http://www.blogger.com/atom/ns#" term="Category"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="NSDictionary"/><category scheme="http://www.blogger.com/atom/ns#" term="NSString"/><title type='text'>短縮URLを作るNSString (shortURL) カテゴリ</title><content type='html'>昨日の短縮URLを展開するNSString (expandURL) カテゴリと対となるカテゴリ。&lt;br /&gt;
Bitly APIを使用しているので、事前にBitlyのアカウントとAPIキーを取得しておく必要がある。また、JSON形式の返り値をNSDictionaryに変換するためにSBJSONを使用している。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NSString+shortURL.h&lt;br /&gt;
&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&amp;lt;Foundation/NSString.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@interface&lt;/span&gt; NSString (shortURL)&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;+ (&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)shortURL:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)longUrl;&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@end&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: Times; font-size: small;&quot;&gt;NSString+shortURL.m&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&quot;NSString+shortURL.h&quot;&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&quot;SBJson.h&quot;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *kBitlyWrapperString = &lt;/span&gt;@&quot;http://api.bit.ly/shorten?version=2.0.1&amp;amp;format=json&amp;amp;longUrl=&quot;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *kBitlyFootterString = &lt;/span&gt;@&quot;&amp;amp;login=ログイン名&amp;amp;apiKey=APIキー&quot;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@implementation&lt;/span&gt; NSString (shortURL)&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;+ (&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)shortURL:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)longUrl{&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *aaa = &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *escapeStr = (&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *)&lt;/span&gt;CFURLCreateStringByAddingPercentEscapes&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;kCFAllocatorDefault&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, (&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;CFStringRef&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)longUrl, &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;CFSTR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;&quot;:/?#[]@!$&amp;amp;’()*+,;=&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;), &lt;/span&gt;kCFStringEncodingUTF8&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;NSString&lt;span style=&quot;color: black;&quot;&gt; *str = [&lt;/span&gt;NSString&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;stringWithFormat&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@%@%@&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;kBitlyWrapperString&lt;span style=&quot;color: black;&quot;&gt;,escapeStr,&lt;/span&gt;kBitlyFootterString&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSURL&lt;/span&gt; *url = [&lt;span style=&quot;color: #4b8186;&quot;&gt;NSURL&lt;/span&gt; &lt;span style=&quot;color: #2e595d;&quot;&gt;URLWithString&lt;/span&gt;:str];&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSData&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *data = [&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSData&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;dataWithContentsOfURL&lt;span style=&quot;color: black;&quot;&gt;:url];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (data) {&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *tempStr = [[[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;alloc&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;initWithData&lt;span style=&quot;color: black;&quot;&gt;:data &lt;/span&gt;encoding&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;NSUTF8StringEncoding&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;autorelease&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSDictionary&lt;/span&gt; *aDic = [tempStr &lt;span style=&quot;color: #2e595d;&quot;&gt;JSONValue&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;NSLog&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,[aDic &lt;/span&gt;description&lt;span style=&quot;color: black;&quot;&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSNumber&lt;/span&gt; *errorCode = [aDic &lt;span style=&quot;color: #2e595d;&quot;&gt;objectForKey&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;errorCode&quot;&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *statusCode = [aDic &lt;span style=&quot;color: #2e595d;&quot;&gt;objectForKey&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;statusCode&quot;&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; ([errorCode &lt;span style=&quot;color: #2e595d;&quot;&gt;intValue&lt;/span&gt;] == &lt;span style=&quot;color: #2832cf;&quot;&gt;0&lt;/span&gt; &amp;amp;&amp;amp; [statusCode &lt;span style=&quot;color: #2e595d;&quot;&gt;isEqualToString&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;OK&quot;&lt;/span&gt;]) {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSDictionary&lt;/span&gt; *results = [[aDic &lt;span style=&quot;color: #2e595d;&quot;&gt;objectForKey&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;results&quot;&lt;/span&gt;]&lt;span style=&quot;color: #2e595d;&quot;&gt;objectForKey&lt;/span&gt;:longUrl];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *shortUrl = [results &lt;span style=&quot;color: #2e595d;&quot;&gt;objectForKey&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;shortUrl&quot;&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;aaa = shortUrl;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;aaa = longUrl;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;aaa = longUrl;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;return&lt;/span&gt; aaa;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@end&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/7037266890638674416/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/urlnsstring-shorturl.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7037266890638674416'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7037266890638674416'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/urlnsstring-shorturl.html' title='短縮URLを作るNSString (shortURL) カテゴリ'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-9206162090645353842</id><published>2011-09-25T23:12:00.005+09:00</published><updated>2011-09-25T23:25:17.542+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Category"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="NSDictionary"/><category scheme="http://www.blogger.com/atom/ns#" term="NSString"/><title type='text'>短縮URLを展開するNSString (expandURL) カテゴリ</title><content type='html'>短縮URLを見ない日はなくなった。&lt;br /&gt;
&lt;div&gt;Twitterなどは自前でt.coなる短縮URLを用意して悪意のある短縮URLからユーザーを守ろうという試みも行われている。また、アクセスの解析も行われているようだ。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;iOSアプリケーションを開発する上では、短縮URLを展開して元URLのURLスキームを解析することにより、UIApplicationの-(BOOL)OpenURL:(NSURL *)メソッドを使用するか否かの判断が可能になる。&lt;/div&gt;&lt;div&gt;これを使用するとSafariやその他の外部アプリケーションが起動されるため、ユーザーが自前のアプリケーションから離れてしまうからだ。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;この短縮URLを展開してくれるAPIが幾つか存在するので、その中の2つを使ってNSStringのカテゴリとしてまとめてみた。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
APIが返す値はJSON形式で返ってくるものを選び、SBJSONを利用してNSDictionary形式に変換、後続の処理を行なっている。失敗した場合は展開前の短縮URLが返るようにしてある。展開できる短縮URLの種類はAPIに依存しているので注意されたし。またAPIサービスそのものの業務継続性にも注意が必要。&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;NSString+expandURL.h&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&amp;lt;Foundation/NSString.h&amp;gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@interface&lt;/span&gt; NSString (expandURL)&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;+ (&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *)expandURL:(&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *)urlStr;&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@end&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;NSString+expandURL.m&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&quot;NSString+expandURL.h&quot;&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&quot;SBJson.h&quot;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@implementation&lt;/span&gt; NSString (expandURL)&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;+ (&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *)expandURL:(&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *)urlStr{&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *str = &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSURL&lt;/span&gt; *url = &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSData&lt;/span&gt; *data = &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *aaa = &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;str = [&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;stringWithFormat&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;@&quot;http://api.unshort.me/?r=%@&amp;amp;t=json&quot;&lt;span style=&quot;color: black;&quot;&gt;,urlStr];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;url = [&lt;span style=&quot;color: #7340a3;&quot;&gt;NSURL&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;URLWithString&lt;/span&gt;:str];&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;data = [&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSData&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;dataWithContentsOfURL&lt;span style=&quot;color: black;&quot;&gt;:url];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (data) {&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *result = [[[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;alloc&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;initWithData&lt;span style=&quot;color: black;&quot;&gt;:data &lt;/span&gt;encoding&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;NSUTF8StringEncoding&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;autorelease&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSDictionary&lt;/span&gt; *aDic = [result &lt;span style=&quot;color: #2e595d;&quot;&gt;JSONValue&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *status = [aDic &lt;span style=&quot;color: #3f217c;&quot;&gt;objectForKey&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;success&quot;&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; ([status &lt;span style=&quot;color: #3f217c;&quot;&gt;isEqualToString&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;true&quot;&lt;/span&gt;]){&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;aaa = [aDic &lt;span style=&quot;color: #3f217c;&quot;&gt;objectForKey&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;resolvedURL&quot;&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;aaa = urlStr;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;str = [&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;stringWithFormat&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;@&quot;http://expandurl.appspot.com/expand?url=%@&quot;&lt;span style=&quot;color: black;&quot;&gt;,urlStr];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;url = [&lt;span style=&quot;color: #7340a3;&quot;&gt;NSURL&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;URLWithString&lt;/span&gt;:str];&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;data = [&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSData&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;dataWithContentsOfURL&lt;span style=&quot;color: black;&quot;&gt;:url];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (data) {&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *result = [[[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;alloc&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;initWithData&lt;span style=&quot;color: black;&quot;&gt;:data &lt;/span&gt;encoding&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;NSUTF8StringEncoding&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;autorelease&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSDictionary&lt;/span&gt; *aDic = [result &lt;span style=&quot;color: #2e595d;&quot;&gt;JSONValue&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *status = [aDic &lt;span style=&quot;color: #3f217c;&quot;&gt;objectForKey&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;status&quot;&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; ([status &lt;span style=&quot;color: #3f217c;&quot;&gt;isEqualToString&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;OK&quot;&lt;/span&gt;]){&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;aaa = [aDic &lt;span style=&quot;color: #3f217c;&quot;&gt;objectForKey&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;end_url&quot;&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;aaa = urlStr;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;aaa = urlStr;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;return&lt;/span&gt; aaa;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@end&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/9206162090645353842/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/urlnsstring-expandurl.html#comment-form' title='1 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/9206162090645353842'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/9206162090645353842'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/urlnsstring-expandurl.html' title='短縮URLを展開するNSString (expandURL) カテゴリ'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-1876034087386540527</id><published>2011-09-14T13:34:00.000+09:00</published><updated>2011-09-14T13:34:13.901+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="UIButton"/><category scheme="http://www.blogger.com/atom/ns#" term="UITableView"/><title type='text'>UITableViewのtableFooterViewにUIButtonを追加する</title><content type='html'>参考画像&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg85Gtf6CtGWz-xHoel_BZXej8Xz0kNTbmUTs7Oz3e_EwQVh3ApVDS4cKm8mBIj3CiBvCAfq3cmoKnu_x6gzDLKGyKuXjA8wNFXkoZyKBXen03yIBfJTGfZekXAU5wrj8UDnKQuZInbYfk/s1600/Screenshot_13.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg85Gtf6CtGWz-xHoel_BZXej8Xz0kNTbmUTs7Oz3e_EwQVh3ApVDS4cKm8mBIj3CiBvCAfq3cmoKnu_x6gzDLKGyKuXjA8wNFXkoZyKBXen03yIBfJTGfZekXAU5wrj8UDnKQuZInbYfk/s320/Screenshot_13.png&quot; width=&quot;164&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;このように追加でデータを読み込むような使い方をするケースが多い。&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;テーブルを引っ張って更新するのが流行りだが、Footerの場合はCellの数によって&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;トリガーとなる基準の位置座標が変わるので、UIButtonで実装する方が簡単。&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;- (void)viewDidLoad{}内でUIButtonを作成してtableViewFooterに設定する。&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)viewDidLoad&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; [&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;viewDidLoad&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3f217c;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;readMoreButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = [&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;buttonWithType&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;UIButtonTypeCustom&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;readMoreButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;addTarget&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;action&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@selector&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(readMoreButtonPushed) &lt;/span&gt;forControlEvents&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;UIControlEventTouchUpInside&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;readMoreButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;setTitle&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;Read more&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;forState&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;UIControlStateNormal&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;readMoreButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;setTitle&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;Load&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;forState&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;UIControlStateHighlighted&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;readMoreButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;setTitle&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;Loading&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;forState&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;UIControlStateDisabled&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;readMoreButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;backgroundColor&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;LIGHT_BACKGROUND&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #7340a3; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;readMoreButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;frame&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;CGRectMake&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2832cf;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #2832cf;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;tableView&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;frame&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;size&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;width&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #2832cf;&quot;&gt;44&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #7340a3; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;tableView&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;tableFooterView&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;readMoreButton&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)readMoreButtonPushed{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;readMoreButton&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;enabled&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;NO&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3f217c;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIAlertView&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *alert = [[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIAlertView&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;alloc&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;initWithTitle&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;message&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;message&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;Read more button pushed.&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;delegate&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;cancelButtonTitle&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;OK&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;otherButtonTitles&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[alert &lt;span style=&quot;color: #3f217c;&quot;&gt;show&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[alert &lt;span style=&quot;color: #2e595d;&quot;&gt;release&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;readMoreButton&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;enabled&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;YES&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
上の実装例は設定したボタンを押すとアラートがポップアップする。&lt;br /&gt;
実際にはデータを読み込む処理や、読み込んだ後に追加されたデータの直前まで&lt;br /&gt;
テーブルをスクロールさせるような処理を追加する。</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/1876034087386540527/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/uitableviewtablefooterviewuibutton.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1876034087386540527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1876034087386540527'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/uitableviewtablefooterviewuibutton.html' title='UITableViewのtableFooterViewにUIButtonを追加する'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg85Gtf6CtGWz-xHoel_BZXej8Xz0kNTbmUTs7Oz3e_EwQVh3ApVDS4cKm8mBIj3CiBvCAfq3cmoKnu_x6gzDLKGyKuXjA8wNFXkoZyKBXen03yIBfJTGfZekXAU5wrj8UDnKQuZInbYfk/s72-c/Screenshot_13.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-7914652882197623437</id><published>2011-09-12T17:23:00.006+09:00</published><updated>2011-09-12T17:38:29.479+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="UIImageView"/><category scheme="http://www.blogger.com/atom/ns#" term="UITableViewCell"/><category scheme="http://www.blogger.com/atom/ns#" term="UITapGestureRecognizer"/><title type='text'>UITableViewCell内部にあるUIImageViewをタップした時の処理</title><content type='html'>UIImageViewを含むカスタマイズされたUITableViewCellがあったとする。&lt;br /&gt;
このUIImageViewをタップした時に何らかの処理を実行したい時の実装例。&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #7340a3;&quot;&gt;UITableViewCell&lt;/span&gt; *)tableView:(&lt;span style=&quot;color: #7340a3;&quot;&gt;UITableView&lt;/span&gt; *)tableView cellForRowAtIndexPath:(&lt;span style=&quot;color: #7340a3;&quot;&gt;NSIndexPath&lt;/span&gt; *)indexPath&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #bf2e9d;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *CellIdentifier = &lt;span style=&quot;color: #7a482f;&quot;&gt;CELLIDENTIFIER&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4b8186;&quot;&gt;MyTableViewCell&lt;/span&gt; *cell = (&lt;span style=&quot;color: #4b8186;&quot;&gt;MyTableViewCell&lt;/span&gt; *)[tableView &lt;span style=&quot;color: #3f217c;&quot;&gt;dequeueReusableCellWithIdentifier&lt;/span&gt;:CellIdentifier];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (cell == &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIViewController&lt;/span&gt;* viewController = [[&lt;span style=&quot;color: #7340a3;&quot;&gt;UIViewController&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;alloc&lt;/span&gt;] &lt;span style=&quot;color: #3f217c;&quot;&gt;initWithNibName&lt;/span&gt;:CellIdentifier &lt;span style=&quot;color: #3f217c;&quot;&gt;bundle&lt;/span&gt;:&lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;color: #008326; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cell = (&lt;span style=&quot;color: #4b8186;&quot;&gt;MyTableViewCell&lt;/span&gt; *)viewController.&lt;span style=&quot;color: #7340a3;&quot;&gt;view&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #008326; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [viewController &lt;span style=&quot;color: #3f217c;&quot;&gt;release&lt;/span&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: #008326; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;// Configure the cell...&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cell.&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;imageURL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;@&quot;http://sample.com/sample.png&quot;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #7340a3; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cell.&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;iconImageView&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;userInteractionEnabled&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;YES&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;cell.&lt;span style=&quot;color: #4b8186;&quot;&gt;iconImageView&lt;/span&gt;.&lt;span style=&quot;color: #7340a3;&quot;&gt;image&lt;/span&gt; = [&lt;span style=&quot;color: #7340a3;&quot;&gt;UIImage&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;imageNamed&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;tapme.png&quot;&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;color: #7340a3; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;UITapGestureRecognizer&lt;span style=&quot;color: black;&quot;&gt; *tapGesture = [[&lt;/span&gt;UITapGestureRecognizer&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;alloc&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;initWithTarget&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@selector&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(tapImage:)];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #7340a3; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;tapGesture.&lt;/span&gt;numberOfTapsRequired&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #2832cf;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[cell.&lt;span style=&quot;color: #4b8186;&quot;&gt;iconImageView&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;addGestureRecognizer&lt;/span&gt;:tapGesture];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[tapGesture &lt;span style=&quot;color: #3f217c;&quot;&gt;release&lt;/span&gt;],tapGesture = &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #bf2e9d;&quot;&gt;return&lt;/span&gt; cell;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)tapImage:(&lt;span style=&quot;color: #bf2e9d;&quot;&gt;id&lt;/span&gt;)sender{&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIImageView&lt;/span&gt; *imgView = (&lt;span style=&quot;color: #7340a3;&quot;&gt;UIImageView&lt;/span&gt; *)[sender &lt;span style=&quot;color: #3f217c;&quot;&gt;view&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; ([imgView.&lt;span style=&quot;color: #7340a3;&quot;&gt;image&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;isEqual&lt;/span&gt;:&lt;span style=&quot;color: #4b8186;&quot;&gt;noImage&lt;/span&gt;]) {&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;BooksTableViewCell&lt;span style=&quot;color: black;&quot;&gt; *cell = (&lt;/span&gt;BooksTableViewCell&lt;span style=&quot;color: black;&quot;&gt; *)[[imgView &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;superview&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;superview&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;NSLog&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,[[imgView &lt;/span&gt;superview&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;class&lt;span style=&quot;color: black;&quot;&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;NSLog&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,[[[imgView &lt;/span&gt;superview&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;superview&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;class&lt;span style=&quot;color: black;&quot;&gt;]);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSURL&lt;/span&gt; *imgURL = [&lt;span style=&quot;color: #7340a3;&quot;&gt;NSURL&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;URLWithString&lt;/span&gt;:cell.&lt;span style=&quot;color: #4b8186;&quot;&gt;imageURL&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;NSLog&lt;/span&gt;(&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@&quot;&lt;/span&gt;,cell.&lt;span style=&quot;color: #4b8186;&quot;&gt;imageURL&lt;/span&gt;);&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIImage&lt;/span&gt; *img = &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSData&lt;/span&gt; *data = [&lt;span style=&quot;color: #7340a3;&quot;&gt;NSData&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;dataWithContentsOfURL&lt;/span&gt;:imgURL];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (data) {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;img = [&lt;span style=&quot;color: #7340a3;&quot;&gt;UIImage&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;imageWithData&lt;/span&gt;:data];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;[cell.&lt;span style=&quot;color: #4b8186;&quot;&gt;iconImageView&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;setImage&lt;/span&gt;:img];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;return&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times; font-size: small;&quot;&gt;上の実装例ではMyTableViewCellに画像URLを持たせて、UIImageViewをタップしたらsample.pngをダウンロードしてtapme.pngと差し替えるといった処理を行っている。&lt;/span&gt;&lt;/div&gt;&lt;div&gt;UITableViewは画像を持つセルを多数表示するとメモリ不足で落ちたりするので、このような処理もメモリ使用量を節減する選択肢となり得る。&lt;/div&gt;&lt;div&gt;実際の実装では画像URLは配列から取り出すことになるだろうし、tapme.pngも1つのインスタンスを使い回すことになるだろう。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;- (void)tapImage:(id)senderメソッドについては、[sender view]は確かにここでいうタップしたiconImageViewなのだが、iconImageViewとMyTableViewCellの間にUITableViewCellContentViewが挟まっているので、それをNSLogで明示している。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/7914652882197623437/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/uitableviewcelluiimageview.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7914652882197623437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7914652882197623437'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/uitableviewcelluiimageview.html' title='UITableViewCell内部にあるUIImageViewをタップした時の処理'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-1114427336248177960</id><published>2011-09-12T16:35:00.001+09:00</published><updated>2011-09-12T16:37:22.030+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Snippet"/><category scheme="http://www.blogger.com/atom/ns#" term="UIImage"/><title type='text'>UIImageを指定サイズにリサイズするSnippet</title><content type='html'>&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #7340a3;&quot;&gt;UIImage&lt;/span&gt; *)resizeImage:(&lt;span style=&quot;color: #7340a3;&quot;&gt;UIImage&lt;/span&gt; *)image width:(&lt;span style=&quot;color: #7340a3;&quot;&gt;CGFloat&lt;/span&gt;)width height:(&lt;span style=&quot;color: #7340a3;&quot;&gt;CGFloat&lt;/span&gt;)height{&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;UIImage&lt;/span&gt; *returnImage = &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;; &lt;span style=&quot;color: #008326;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008326; font: 11.0px &#39;Hiragino Kaku Gothic ProN&#39;;&quot;&gt;リサイズ後の&lt;/span&gt;&lt;span style=&quot;color: #008326;&quot;&gt;UIImage&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;UIGraphicsBeginImageContext&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;CGSizeMake&lt;span style=&quot;color: black;&quot;&gt;(width, height));&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[image &lt;span style=&quot;color: #3f217c;&quot;&gt;drawInRect&lt;/span&gt;:&lt;span style=&quot;color: #3f217c;&quot;&gt;CGRectMake&lt;/span&gt;(&lt;span style=&quot;color: #2832cf;&quot;&gt;0&lt;/span&gt;, &lt;span style=&quot;color: #2832cf;&quot;&gt;0&lt;/span&gt;, width, height)];&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;returnImage = &lt;/span&gt;UIGraphicsGetImageFromCurrentImageContext&lt;span style=&quot;color: black;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;UIGraphicsEndImageContext&lt;span style=&quot;color: black;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;return&lt;/span&gt; returnImage;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/1114427336248177960/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/uiimagesnippet.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1114427336248177960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1114427336248177960'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/uiimagesnippet.html' title='UIImageを指定サイズにリサイズするSnippet'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-2408654072020930290</id><published>2011-09-12T16:09:00.005+09:00</published><updated>2011-09-12T16:20:30.964+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="NSArray"/><category scheme="http://www.blogger.com/atom/ns#" term="NSCountedSet"/><category scheme="http://www.blogger.com/atom/ns#" term="NSDictionary"/><category scheme="http://www.blogger.com/atom/ns#" term="PropertyList"/><title type='text'>PropertyListからNSDictionaryを作り、Keyをアルファベット順に並べ替えてNSArrayに格納する</title><content type='html'>まずはPropertyListを作る。&lt;br /&gt;
仮にDictionary.plistとする。&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9G3BgjNGmHG_wlhEGSpH-Dmvx4ilm40RjLBM4-iF_JDmWi7SQEYKfbdkGbz3WSboWMqKEipzJNVTFzm2z0vMZD5hOLZGh2itXTMYowSvzvOOIEzcwFFkrfcHtg2DhGycz1OLtUnBqpHk/s1600/dictionary.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9G3BgjNGmHG_wlhEGSpH-Dmvx4ilm40RjLBM4-iF_JDmWi7SQEYKfbdkGbz3WSboWMqKEipzJNVTFzm2z0vMZD5hOLZGh2itXTMYowSvzvOOIEzcwFFkrfcHtg2DhGycz1OLtUnBqpHk/s1600/dictionary.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Dictionary.plist&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
次にDictionary.plistからNSDictionaryを作る。&lt;br /&gt;
&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3f217c;&quot;&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3f217c;&quot;&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *path = [[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSBundle&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;mainBundle&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;pathForResource&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;Dictionary&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;ofType&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;plist&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3f217c;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSDictionary&lt;/span&gt; *myDictionary = [[&lt;span style=&quot;color: #7340a3;&quot;&gt;NSDictionary&lt;/span&gt; &lt;span style=&quot;color: #3f217c;&quot;&gt;alloc&lt;/span&gt;]&lt;span style=&quot;color: #3f217c;&quot;&gt;initWithContentsOfFile&lt;/span&gt;:path];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Times; font-size: small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;最後にKeyをアルファベット順に並べ替えてNSArrayに格納する。&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSCountedSet&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *cset = [[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSCountedSet&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;alloc&lt;span style=&quot;color: black;&quot;&gt;] &lt;/span&gt;initWithArray&lt;span style=&quot;color: black;&quot;&gt;:[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;myDictionary&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;allKeys&lt;span style=&quot;color: black;&quot;&gt;]];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSArray&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *keyArray = [[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSArray&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;alloc&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;initWithArray&lt;span style=&quot;color: black;&quot;&gt;:[[cset &lt;/span&gt;allObjects&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;sortedArrayUsingSelector&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@selector&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(compare:)]];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;[cset &lt;span style=&quot;color: #3f217c;&quot;&gt;release&lt;/span&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;このmyDictionaryとkeyArrayをUITableViewControllerクラスのメンバとしておけば、keyArrayをUITableViewのテーブルの表示やセルタイトルに使い、テーブルセル選択時にセルのタイトルをkeyとしてmyDictionaryのvalueが取り出せる。&lt;/div&gt;&lt;div&gt;NSDictionaryのKeyを配列として持ちたい、かつそれがアルファベット順であってほしい時にこれを使う。あるいはテーブルの構成要素をプロパティリストで表現したい時にも使える。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/2408654072020930290/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/propertylistnsdictionarykeynsarray.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/2408654072020930290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/2408654072020930290'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/propertylistnsdictionarykeynsarray.html' title='PropertyListからNSDictionaryを作り、Keyをアルファベット順に並べ替えてNSArrayに格納する'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9G3BgjNGmHG_wlhEGSpH-Dmvx4ilm40RjLBM4-iF_JDmWi7SQEYKfbdkGbz3WSboWMqKEipzJNVTFzm2z0vMZD5hOLZGh2itXTMYowSvzvOOIEzcwFFkrfcHtg2DhGycz1OLtUnBqpHk/s72-c/dictionary.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-2752941132081329611</id><published>2011-09-12T15:00:00.018+09:00</published><updated>2011-09-15T18:13:07.479+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bitly"/><category scheme="http://www.blogger.com/atom/ns#" term="NSXMLParser"/><title type='text'>NSXMLParserとBitlyAPIを使って短縮URLを作る</title><content type='html'>BitlyShortURLというNSObjectのサブクラスを作る。&lt;br /&gt;
&lt;br /&gt;
まずはBitlyShortURL.h&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&amp;lt;Foundation/Foundation.h&amp;gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@interface&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; BitlyShortURL : &lt;/span&gt;NSObject&lt;span style=&quot;color: black;&quot;&gt; &amp;lt;&lt;/span&gt;NSXMLParserDelegate&lt;span style=&quot;color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *_baseURL; &lt;span style=&quot;color: #008326;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008326; font: normal normal normal 11px/normal &#39;Hiragino Kaku Gothic ProN&#39;;&quot;&gt;短縮される元&lt;/span&gt;&lt;span style=&quot;color: #008326;&quot;&gt;URL&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #008326; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *_resultURL; &lt;/span&gt;//API&lt;span style=&quot;font: normal normal normal 11px/normal &#39;Hiragino Kaku Gothic ProN&#39;;&quot;&gt;によって短縮された&lt;/span&gt;URL&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;id&lt;/span&gt;)initWithLongURL:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)longURL; &lt;span style=&quot;color: #008326;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008326; font: normal normal normal 11px/normal &#39;Hiragino Kaku Gothic ProN&#39;;&quot;&gt;元&lt;/span&gt;&lt;span style=&quot;color: #008326;&quot;&gt;URL&lt;/span&gt;&lt;span style=&quot;color: #008326; font: normal normal normal 11px/normal &#39;Hiragino Kaku Gothic ProN&#39;;&quot;&gt;を使って初期化&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #008326; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;- (&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *)parse; &lt;/span&gt;//&lt;span style=&quot;font: normal normal normal 11px/normal &#39;Hiragino Kaku Gothic ProN&#39;;&quot;&gt;パースして短縮&lt;/span&gt;URL&lt;span style=&quot;font: normal normal normal 11px/normal &#39;Hiragino Kaku Gothic ProN&#39;;&quot;&gt;を返す&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@end&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;次にBitlyShortURL.m&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&quot;BitlyShortURL.h&quot;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *kBitlyWrapperString = &lt;/span&gt;@&quot;http://api.bit.ly/shorten?version=2.0.1&amp;amp;format=xml&amp;amp;longUrl=&quot;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *kBitlyFootterString = &lt;/span&gt;@&quot;&amp;amp;login=ログイン名&amp;amp;apiKey=APIキー&quot;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@implementation&lt;span style=&quot;color: black;&quot;&gt; BitlyShortURL&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)returnLink:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)str{&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *)&lt;/span&gt;CFURLCreateStringByAddingPercentEscapes&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;kCFAllocatorDefault&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, (&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;CFStringRef&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)str, &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;CFSTR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;&quot;:/?#[]@!$&amp;amp;’()*+,;=&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;), &lt;/span&gt;kCFStringEncodingUTF8&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;id&lt;/span&gt;)initWithLongURL:(&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt; *)longURL{&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;self&lt;span style=&quot;color: black;&quot;&gt; = [&lt;/span&gt;super&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;init&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *str = [&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;stringWithFormat&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@%@%@&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;kBitlyWrapperString&lt;span style=&quot;color: black;&quot;&gt;,[&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;returnLink&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:longURL],&lt;/span&gt;kBitlyFootterString&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #3f217c; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;_baseURL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = [[&lt;/span&gt;&lt;span style=&quot;color: #7340a3;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;alloc&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;initWithString&lt;span style=&quot;color: black;&quot;&gt;:str];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #3f217c;&quot;&gt;NSLog&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;/span&gt;_baseURL&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;_resultURL&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;error&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;return&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;self&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)parse{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;NSURL&lt;span style=&quot;color: black;&quot;&gt; *url = [&lt;/span&gt;NSURL&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;URLWithString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;_baseURL&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *parser = [[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;alloc&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;initWithContentsOfURL&lt;span style=&quot;color: black;&quot;&gt;:url];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[parser &lt;span style=&quot;color: #2e595d;&quot;&gt;setDelegate&lt;/span&gt;:&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[parser &lt;span style=&quot;color: #2e595d;&quot;&gt;parse&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #4b8186;&quot;&gt;_resultURL&lt;/span&gt; == &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;_resultURL&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;error&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;_resultURL&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)dealloc{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[&lt;/span&gt;_baseURL&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;release&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;],&lt;/span&gt;_baseURL&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[&lt;/span&gt;_resultURL&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;release&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;],&lt;/span&gt;_resultURL&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;dealloc&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#pragma mark -&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#pragma mark NSXMLParserDelegate Protocol&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parserDidStartDocument:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parserDidEndDocument:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parser:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser didStartElement:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)elementName&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; namespaceURI:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)namespaceURI qualifiedName:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)qualifiedName&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;attributes:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSDictionary&lt;/span&gt; *)attributeDict {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;NSLog&lt;/span&gt;(&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;&amp;lt;%@&amp;gt;&quot;&lt;/span&gt;,elementName);&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; ([elementName &lt;span style=&quot;color: #2e595d;&quot;&gt;isEqualToString&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;shortUrl&quot;&lt;/span&gt;]) {&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;[&lt;/span&gt;_resultURL&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;release&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;],&lt;/span&gt;_resultURL&lt;span style=&quot;color: black;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parser:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser foundCharacters:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)string {&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;NSLog&lt;/span&gt;(&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@&quot;&lt;/span&gt;,string);&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #4b8186;&quot;&gt;_resultURL&lt;/span&gt; == &lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;_resultURL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = [[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;alloc&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;initWithString&lt;span style=&quot;color: black;&quot;&gt;:string];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parser:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser didEndElement:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)elementName&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; namespaceURI:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)namespaceURI qualifiedName:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)qName {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;NSLog&lt;/span&gt;(&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;&amp;lt;/%@&amp;gt;&quot;&lt;/span&gt;,elementName);&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@end&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;パースされた要素の通り、他にも色々な情報があるがとりあえず短縮URLを手に入れたい！って時にこれから始める。&lt;/div&gt;&lt;div&gt;異常時には結果に@&quot;error&quot;が入るので、これを後続の条件分岐に使うと良い。&lt;br /&gt;
&lt;br /&gt;
bitlyのReferenceは&lt;a href=&quot;http://code.google.com/p/bitly-api/wiki/ApiDocumentation&quot;&gt;GoogleCode&lt;/a&gt;でどうぞ。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/2752941132081329611/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/nsxmlparserbitlyapiurl.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/2752941132081329611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/2752941132081329611'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/nsxmlparserbitlyapiurl.html' title='NSXMLParserとBitlyAPIを使って短縮URLを作る'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-5754927280049405180</id><published>2011-09-12T14:42:00.001+09:00</published><updated>2011-09-12T14:43:38.698+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Snippet"/><category scheme="http://www.blogger.com/atom/ns#" term="UIDevice"/><title type='text'>iOSのバージョン判定のSnippet</title><content type='html'>iOSのバージョンによって処理を変えたい時などに使うSnippet&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; *versions = [[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;UIDevice&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;currentDevice&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;systemVersion&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ([versions &lt;/span&gt;compare&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;5.0&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;] != &lt;/span&gt;NSOrderedAscending&lt;span style=&quot;color: black;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;} &lt;span style=&quot;color: #bf2e9d;&quot;&gt;else&lt;/span&gt; {&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;上の例はiOS5.0以上なら正とする場合の実装例。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/5754927280049405180/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/iossnippet.html#comment-form' title='1 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/5754927280049405180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/5754927280049405180'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/iossnippet.html' title='iOSのバージョン判定のSnippet'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-7590925009757548634</id><published>2011-09-12T14:24:00.051+09:00</published><updated>2011-09-12T18:04:09.951+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="NSXMLParser"/><title type='text'>NSXMLParserの基本形</title><content type='html'>NSXMLParserのサブクラスを作成する。&lt;br /&gt;
ここでは&lt;br /&gt;
XMLParser.h&lt;br /&gt;
XMLParser.m&lt;br /&gt;
とする。&lt;br /&gt;
&lt;br /&gt;
まずはXMLParser.h&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #d62b24; font-family: Menlo; font-size: 11px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #d62b24; font-family: Menlo; font-size: 11px;&quot;&gt;&amp;lt;Foundation/Foundation.h&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font: normal normal normal 11px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4b8186;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #4b8186;&quot;&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@interface&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; XMLParser : &lt;/span&gt;NSXMLParser&lt;span style=&quot;color: black;&quot;&gt; &amp;lt;&lt;/span&gt;NSXMLParserDelegate&lt;span style=&quot;color: black;&quot;&gt;&amp;gt; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@end&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;次にXMLParser.m&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;color: #d62b24; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;#import &lt;/span&gt;&quot;XMLParser.h&quot;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@implementation&lt;span style=&quot;color: black;&quot;&gt; XMLParser&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #bf2e9d;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#pragma mark -&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#pragma mark Object lifecycle&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;id&lt;/span&gt;)initWithContentsOfURL:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSURL&lt;/span&gt; *)url {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; = [&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;initWithContentsOfURL&lt;span style=&quot;color: black;&quot;&gt;:url];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;[&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;setDelegate&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;return&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;self&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;id&lt;/span&gt;)initWithData:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSData&lt;/span&gt; *)data {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt; = [&lt;span style=&quot;color: #bf2e9d;&quot;&gt;super&lt;/span&gt; &lt;span style=&quot;color: #2e595d;&quot;&gt;initWithData&lt;/span&gt;:data];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;) {&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;[&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;setDelegate&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;return&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;self&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;) dealloc {&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;dealloc&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#pragma mark -&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#pragma mark NSXMLParserDelegate Protocol&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parserDidStartDocument:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parserDidEndDocument:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parser:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser didStartElement:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)elementName&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; namespaceURI:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)namespaceURI qualifiedName:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)qualifiedName&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;attributes:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSDictionary&lt;/span&gt; *)attributeDict {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;NSLog&lt;/span&gt;(&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;&amp;lt;%@&amp;gt;&quot;&lt;/span&gt;,elementName);&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parser:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser foundCharacters:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)string {&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;NSLog&lt;/span&gt;(&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@&quot;&lt;/span&gt;,string);&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)parser:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSXMLParser&lt;/span&gt; *)parser didEndElement:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)elementName&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; namespaceURI:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)namespaceURI qualifiedName:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)qName {&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;NSLog&lt;/span&gt;(&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #d62b24;&quot;&gt;&amp;lt;/%@&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;&quot;&lt;/span&gt;,elementName);&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 13.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #bf2e9d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;@end&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;まずは対象となるXMLの要素をNSLogで出力して、どの要素が必要なのかを確認してから中身を実装していくとよい。&lt;/div&gt;&lt;div&gt;必要な要素に対応したクラスを作成して、それをNSMutableArrayに格納するとUITableViewなどで使い勝手が良い。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/7590925009757548634/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/nsxmlparser.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7590925009757548634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7590925009757548634'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/nsxmlparser.html' title='NSXMLParserの基本形'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-8703884770759296081</id><published>2011-09-12T14:09:00.002+09:00</published><updated>2011-09-12T14:11:27.451+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Snippet"/><title type='text'>NSLog()文を除去するSnippet</title><content type='html'>${PRODUCT_NAME}-Prefix.pch内に次のコードを挿入する。&lt;br /&gt;
不要時には/* */で囲んでコメントアウトしてやる。&lt;br /&gt;
デバッグ時にも使うときと使わない時があるのでこの方法を採用している。&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #008326; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;//NSLog()&lt;span style=&quot;font: normal normal normal 11px/normal &#39;Hiragino Kaku Gothic ProN&#39;;&quot;&gt;文を除去&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#ifndef NSLog&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#define NSLog(m, args...)&lt;/div&gt;&lt;div style=&quot;color: #7a482f; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;#endif&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/8703884770759296081/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/nslogsnippet.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/8703884770759296081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/8703884770759296081'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/nslogsnippet.html' title='NSLog()文を除去するSnippet'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-1248357126851608211</id><published>2011-09-12T14:00:00.002+09:00</published><updated>2011-09-12T18:02:51.349+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="NSNotificationCenter"/><category scheme="http://www.blogger.com/atom/ns#" term="Snippet"/><title type='text'>NSNotificationCenterのサンプルSnippet</title><content type='html'>登録、通知、監視、登録解除の流れをごく簡単に列挙。&lt;br /&gt;
&lt;br /&gt;
登録&lt;br /&gt;
&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;NSNotificationCenter&lt;span style=&quot;color: black;&quot;&gt; *nc = [&lt;/span&gt;NSNotificationCenter&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;defaultCenter&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;[nc &lt;span style=&quot;color: #2e595d;&quot;&gt;addObserver&lt;/span&gt;:&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt; &lt;span style=&quot;color: #2e595d;&quot;&gt;selector&lt;/span&gt;:&lt;span style=&quot;color: #bf2e9d;&quot;&gt;@selector&lt;/span&gt;(valueChanged:) &lt;span style=&quot;color: #2e595d;&quot;&gt;name&lt;/span&gt;:&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;ValueChanged&quot;&lt;/span&gt; &lt;span style=&quot;color: #2e595d;&quot;&gt;object&lt;/span&gt;:&lt;span style=&quot;color: #bf2e9d;&quot;&gt;nil&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;通知&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *value = &lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;Value&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;NSNotification&lt;span style=&quot;color: black;&quot;&gt; *n = [&lt;/span&gt;NSNotification&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;notificationWithName&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;ValueChanged&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:value];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;[[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSNotificationCenter&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;defaultCenter&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;postNotification&lt;span style=&quot;color: black;&quot;&gt;:n];&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: black;&quot;&gt;監視&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: black;&quot;&gt;※事前に登録をしておいた上でselectorのメソッドを実装する。&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Menlo; font-size: 11px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)valueChanged:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSNotification&lt;/span&gt; *)n{&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Menlo; font-size: 11px;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Menlo; font-size: 11px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *str = n.&lt;span style=&quot;color: #7340a3;&quot;&gt;object&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Menlo; font-size: 11px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #7a482f;&quot;&gt;NSLog&lt;/span&gt;(&lt;span style=&quot;color: #d62b24;&quot;&gt;@&quot;%@&quot;&lt;/span&gt;,str);&lt;/span&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Menlo; font-size: 11px;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Menlo;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 11px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;登録削除&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;void&lt;/span&gt;)viewDidUnload&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Menlo; font-size: 11px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #2e595d;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;[[&lt;/span&gt;&lt;span style=&quot;color: #4b8186;&quot;&gt;NSNotificationCenter&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;defaultCenter&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;removeObserver&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #2e595d; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &amp;nbsp; [&lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;super&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;viewDidUnload&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/1248357126851608211/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/nsnotificationcenter.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1248357126851608211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/1248357126851608211'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/nsnotificationcenter.html' title='NSNotificationCenterのサンプルSnippet'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-7125297219993831385</id><published>2011-09-12T13:47:00.002+09:00</published><updated>2011-09-12T18:01:45.306+09:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="NSUserDefaults"/><category scheme="http://www.blogger.com/atom/ns#" term="Snippet"/><title type='text'>NSUserDefaultsのサンプルSnippet</title><content type='html'>設定画面などでお世話になるNSUserDefaultsの使い方メモ&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;BOOL&lt;/span&gt;)setBoolValue:(&lt;span style=&quot;color: #bf2e9d;&quot;&gt;BOOL&lt;/span&gt;)value forKey:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)key{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;NSUserDefaults&lt;span style=&quot;color: black;&quot;&gt; *userDefault = [&lt;/span&gt;NSUserDefaults&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;standardUserDefaults&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[userDefault &lt;span style=&quot;color: #2e595d;&quot;&gt;setBool&lt;/span&gt;:value &lt;span style=&quot;color: #2e595d;&quot;&gt;forKey&lt;/span&gt;:key];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;return&lt;/span&gt; [userDefault &lt;span style=&quot;color: #2e595d;&quot;&gt;synchronize&lt;/span&gt;];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;- (&lt;span style=&quot;color: #bf2e9d;&quot;&gt;BOOL&lt;/span&gt;)getBoolValueforKey:(&lt;span style=&quot;color: #4b8186;&quot;&gt;NSString&lt;/span&gt; *)key{&lt;/div&gt;&lt;div style=&quot;color: #4b8186; font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;/span&gt;NSUserDefaults&lt;span style=&quot;color: black;&quot;&gt; *userDefault = [&lt;/span&gt;NSUserDefaults&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #2e595d;&quot;&gt;standardUserDefaults&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #bf2e9d;&quot;&gt;return&lt;/span&gt; [userDefault &lt;span style=&quot;color: #2e595d;&quot;&gt;boolForKey&lt;/span&gt;:key];&lt;/div&gt;&lt;div style=&quot;font: 11.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;&quot;&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/7125297219993831385/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/nsuserdefaults.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7125297219993831385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/7125297219993831385'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/nsuserdefaults.html' title='NSUserDefaultsのサンプルSnippet'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7206505437889765133.post-2532129170599963241</id><published>2011-09-09T18:48:00.001+09:00</published><updated>2011-09-09T18:52:45.323+09:00</updated><title type='text'>7bunnies.comのブログ運用を始めました。</title><content type='html'>ここではiOSアプリ開発の近況を中心に活動内容を不定期に書いていきたいなと思います。&lt;br /&gt;
筆不精なので更新が途切れることもあるかと思いますが温かい目で見守ってくださることを期待しております。</content><link rel='replies' type='application/atom+xml' href='http://blog.7bunnies.com/feeds/2532129170599963241/comments/default' title='コメントの投稿'/><link rel='replies' type='text/html' href='http://blog.7bunnies.com/2011/09/7bunniescom.html#comment-form' title='0 件のコメント'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/2532129170599963241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7206505437889765133/posts/default/2532129170599963241'/><link rel='alternate' type='text/html' href='http://blog.7bunnies.com/2011/09/7bunniescom.html' title='7bunnies.comのブログ運用を始めました。'/><author><name>7bunnies Inc.</name><uri>http://www.blogger.com/profile/02646117781462251238</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9uhF0JEkXTFxNHbkQMDjpfmypUwmotjDDyOvT6Kz7YXmz26ahnhl4RgvEjOadj--5xAZyc0uk_SVoK1a7KdbgTUYg7WO1rtCs-AekWPqCJUWc8633tcz7HL4bmVK78g/s220/7buz-logo.png'/></author><thr:total>0</thr:total></entry></feed>