<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="ja-JP">
<channel rdf:about="http://different-view.jp/~vette/108/swift/index.rdf">
<title>Switf blog</title>
<link>http://different-view.jp/~vette/108/swift/</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://different-view.jp/~vette/108/swift/" />
<description></description>
<dc:creator>vette</dc:creator>
<items><rdf:Seq>
<rdf:li rdf:resource="http://different-view.jp/~vette/108/swift/?date=20141022"/>
<rdf:li rdf:resource="http://different-view.jp/~vette/108/swift/?date=20141021"/>
</rdf:Seq></items>
</channel>
<item rdf:about="http://different-view.jp/~vette/108/swift/?date=20141022">
<title>Your First iOS Application</title>
<link>http://different-view.jp/~vette/108/swift/?date=20141022</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://different-view.jp/~vette/108/swift/?date=20141022" />
<dc:creator>vette</dc:creator>
<dc:date>2014-10-23T02:45:18+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>HelloWorldサンプルアプリ作成を通じてiOSアプリの作り方を知るためのドキュメント。(名前を入れてボタンを押すとgreetingを表示するアプリ)</p>
<ul>
<li>原文：<a href="http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhone101/Articles/00_Introduction.html">Your First iOS Application</a>(英文）</li>
<li>Apple日本語訳：<a href="http://developer.apple.com/jp/devcenter/ios/library/documentation/iPhone101.pdf">iOS アプリケーション チュートリアル</a>(日本語PDF)</li>
</ul>
<hr>
<blockquote><p>注：2014/10/22 iOS7以降、およびXcode5以降では最初のサンプルが変わりました。こちらを参照→<a href="https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/index.html">Start Developing iOS Apps Today</a>。上にある原文のリンクもこちらにリダイレクトされます。当ページの説明はすでに古い内容になります。</p>
</blockquote>
<blockquote><p>注：iOS5およびXcode4.2になったことで、Interface Builderの使い方が大きく変わって、このサンプルも最新版(2011/10/12版）ではStory Boardを使う例に変わってます。従って、現時点では以下の記載は「動くけどiOS5の標準パターンではない」開発スタイルになってます。</p>
</blockquote>
<hr>
<p>2010-07-01版に従って記載</p>
<p>日本語訳もあるので、全体は訳さず肝心なところだけメモ</p>
<ul>
<li>UIApplicationとDelegate、View Controller の関係は「」の説明と手順は違うもののほぼ同等で重複あり。</li>
<li>「」は touch イベントの処理と、メインのViewにさらにサブViewを設定する例だった。(その代わり Interface Builder 周りは設定済だったので説明なし）</li>
</ul>
<p>このドキュメントでわかること</p>
<ul>
<li>シンプルのアプリをはじめから作るときの手順</li>
<li>@property/@synthesizeの使い方</li>
<li>メモリ管理とメモリをreleaseする必要性</li>
<li>Interface Builder でインターフェース部品を配置してアプリのOutletまたはTargetと接続すること</li>
<li>アプリケーションDelegateの役割</li>
<li>ViewControllerの役割</li>
<li>nibファイルからViewをロードするときの手順</li>
<li>File's Ownerの役割</li>
<li>Interface Builderでテキストフィールドのキーボードの設定をする方法</li>
<li>キーボードを閉じる方法</li>
</ul>
<hr>
<p>目次
</p>
<hr>

</div>
<div class="section">

<h3>Tutorial Overview and Design Patterns</h3>
<h4>デザインパターン</h4>
<ul>
<li>デザインパターンの詳細は<a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html">Cocoa Fundamentals Guide</a> の <a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html">Cocoa Design Patterns</a> を見ること。</li>
</ul>
<ul>
<li>サンプルでは Delegation、Model-View-Controller、Target-Action を説説明</li>
</ul>
<h4>Delegate</h4>
<ul>
<li>クラス継承の代替手段として、オブジェクトを再利用する。</li>
<li>Delegateはプロトコルを実装する形を取っており、呼び出し側からの要求に対するInterfaceはDelegeteが吸収する。その先にアプリのModelなどがいるが、このクラスは要求に応えるために継承するということをしなくてもよくなる。イベントハンドリングのために呼ばれるメソッドをアプリのモデルでは直接実装しない。</li>
</ul>
<h4>Model-View-Controller</h4>
<p>一般的なMVCの記述なので割愛。</p>
<h4>Target-Action</h4>

</div>
<div class="section">

<h3>Creating Your Project</h3>
<h4>プロジェクトの作成</h4>
<ul>
<li>「Window-Based Application」として作成する。</li>
<li>Delegateは自動的に「プロジェクト名+Delegate.m/.h」として作成される。</li>
</ul>
<h4>アプリの起動の流れ</h4>
<p>1.main関数が呼ばれるとUIAplicationMainクラスが呼ばれる(main関数で約束のように呼んでいる）</p>
<blockquote><p>int retVal = UIApplicationMain(argc, argv, nil, nil);</p>
</blockquote>
<p>2.UIAplicationMainはUIAplicationクラスが生成されたのち、info.plistから&lt;NSMainNibFile&gt;の情報を検索する。この場合plistのエントリには"MainWindow"と書かれているので、"MainWindow"というnibファイル(.xib)がロードされる。</p>
<p>(IBを詳細表示することはあまりないがファイル名などわかりやすいように表示)</p>
<dl>
<dt>File's Owner</dt>
<dd>プロキシオブジェクト。UIApplicationのインスタンス。つまりアプリケーションで最初に生成されるインスタンス。
</dd>
<dt>First Responder</dt>
<dd>プロキシオブジェクト。このサンプルでは使わない(えー･･)
</dd>
<dt>xxxDelegate</dt>
<dd>アプリケーションのDelegateのインスタンス
</dd>
<dt>Window</dt>
<dd>アプリケーションの枠・背景となるウィンドウ。
</dd>
</dl>
<p>3.セットアップが終わるとDelegateに対して <em>application:didFinishLaunchingWithOptions:</em> メッセージを送信する。（この後でアプリ固有の初期処理が始まる）Delegateはそれを受けると通常はアプリを生成するのではなく、</p>
<ol>
<li>ViewController を生成</li>
<li>ViewControllerから View を取得して</li>
<li>WindowにそのViewをsubviewとして追加する。</li>
</ol>
<p>※詳細は後述。この流れについては「」でも説明があった。</p>

</div>
<div class="section">

<h3>ビューコントローラーを追加する。</h3>
<h4>View Controllerクラスのソースを生成する。</h4>
<p>アプリケーションDelegateはテンプレートで作成されるが、ViewController はないのでこれから作成する。</p>
<ul>
<li>ViewControllerはViewの管理をするだけでなく、画面間のナビゲーションやメモリ管理もする。</li>
<li>UIKitの "<strong>UIViewController</strong>" クラスで基本動作が用意されているので、カスタマイズしたい場合はサブクラス化してオーバーライドする。</li>
<li>UIViewControllerのサブクラスを作成するには、ダイアログのiOSのカテゴリーから「Cocoa Touch Class」、右のクラスの種類から「<strong>UIViewController subClass</strong>」を選択(その際必ず下の「With XIB for user interface」にチェックする）。クラス名は"MyViewController"とかそんな感じで。</li>
</ul>
<h4>Delegateに View Controller のプロパティを追加する</h4>
<p>アプリが起動している間、View Controllerを存続させるために、Delegateのインスタンス変数に View Controller を追加する（※Delegateからの参照カウントが残っている限り解放されないようにするため）</p>
<p>HelloWorldDelegateのinterfaceは以下のような感じになる。なお、MyViewControllerの前方参照のために @classを指定してプロトタイプ宣言している。</p>
<pre>→"MyViewController.h"をimportしてもよい。</pre>
<p>@propertyディレクティブを使っているので、getter/setterが自動的に生成される。また<em>retain</em>(保持)を指定している。</p>
<pre>HelloWorldAppDelegate.hの内容
#import &lt;UIKit/UIKit.h&gt;
@class MyViewController;

@interface HelloWorldAppDelegate :NSObject &lt;UIApplicationDelegate&gt;  {
    UIWindow *window;
    MyViewController *myViewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) MyViewController *myViewController;

@end</pre>
<h4>View Controllerインスタンスを生成する</h4>
<pre>①
MyViewController *aViewController =
                    [[MyViewController alloc]
                         initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]];
②
[self setMyViewController:aViewController];
③
[aViewController release];</pre>
<ul>
<li>View Controllerの初期化<ul>
<li>initWithNibName:bundle: メッセージを使うと、nibファイル名の中から指定したバンドルを使って初期化する。バンドルを使う方が(パスではなく）名前を指定するだけで操作できて簡単だし、ローカリゼーションも考慮されているので便利。</li>
</ul></li>
<li>View Controllerオブジェクトのメモリ管理<ul>
<li>allocでオブジェクトを生成する(生成者が所有権を持つ）</li>
<li>そのオブジェクトを保持したい場合はインスタンス変数に設定する。</li>
<li>allocしたオブジェクトの所有権を放棄する。この例でもreleaseしている。</li>
<li>生成するときにautorelease を指定することもできるが、releaseタイミングを制御できないので、自分でreleaseを呼ぶべき。</li>
</ul></li>
<li>[self setMyViewController:aViewController]; はメッセージの形式ではなくドット記法で self.myViewController = aViewController; と書くこともできる。プロパティへの代入文はsetメソッドのメッセージ呼び出しと同じ動きをする。</li>
</ul>
<pre>※initWithNibName:bundle:でnibファイル名を間違えていてもそのタイミングではエラーにならない(少なくともシミュレータでは）。</pre>
<h4>ビューのセットアップ</h4>
<ul>
<li>WindowのViewは自分で直接生成するのではなく、View Controller に依頼して作成する。</li>
</ul>
<p>前の処理でallocしたView Controllerはrelaseされているが、インスタンス変数の方に対してViewを依頼する。</p>
<pre>UIView *controllersView = [myViewController view];
[window addSubview:controllersView];</pre>
<pre>※ここでviewを取り出しているが、allocなどMemory Management Rulesで指定されている手段で生成しているわけではないので、インスタンスは個別に保持されないためreleaseも不要。</pre>
<p>上の処理が終わってから以下の処理を呼ぶ。</p>
<pre>[window makeKeyAndVisible];</pre>
<p>この処理を呼ぶと画面が描画されてしまうので、アプリの準備（Viewの登録を含む)が終わるまで呼んではいけない。</p>
<h4>残りの仕事</h4>
<h5>インスタンスのrelease</h5>
<p>deallocメソッドでインスタンスの解放を行う。</p>
<pre>- (void)dealloc {
    [myViewController release];  //インスタンス変数に保持していたのでreleaseする
    [window release];  // windowもreleaseする
    [super dealloc];
}</pre>
<h5>インスタンス変数(プロパティ)のsynthesize</h5>
<p>interfaceで@property宣言していたものについて、sette/getterを宣言通り生成させるために @synthesizeを行う。</p>
<pre>interface
  @property (nonatomic, retain) IBOutlet UIWindow *window;
  @property (nonatomic, retain) MyViewController *myViewController;</pre>
<p>↑↓</p>
<pre>implements
  @synthesize window;
  @synthesize myViewController;</pre>

</div>
<div class="section">

<h3>nibファイルの調査</h3>
<p>MyViewController.xibファイルを開いたところ。(ソースを作るときにInterfaceBuilderを使うとチェックしたので作成されている）。MainWindow.xibとは構成要素が違う。viewはこのViewControllerが表示するViewとして独立している。</p>
<h4>File's Ownerについて</h4>
<ul>
<li>File's Ownerはnibファイルをロードしたタイミングでは生成されず、アプリが生成する。</li>
<li>File's Ownerは「インターフェースを所有するオブジェクトである」(WindowまたはViewを所有するという意味か)→"<a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html">Resource Programming Guide</a>" の "About the File’s Owner" 参照。</li>
<li>ここではFile's Ownerは"MyViewController"のインスタンスである（←MainWindow.xibでは、UIApplicationだった）</li>
</ul>
<h4>Viewアウトレット</h4>
<p>File's Ownerを選択してControl+クリックすると接続状態を表示できる。</p>
<p><em>Outlet</em>としてViewControllerのviewが確認できる。ViewControllerのview(ここではインスタンス変数）がViewオブジェクトに接続されているので、UIViewインスタンス(View)がロードされたときにはViewControllerのview変数の内容がViewに設定されることになる。</p>
<h4>nibファイルのロード</h4>
<ul>
<li>生成されたViewControllerにviewを返すよう要求すると、<em>view</em>メソッドが呼ばれたときにまだviewが作成していなければ自動的に<em>loadView</em>メソッドを呼び出す。</li>
<li>ViewControllerのViewを独自実装したい場合は、<em>loadView</em>をオーバーライドする。</li>
<li><em>initWithNibNam:bundle:</em> でviewを初期化したあとで追加の設定が必要な場合は、<em>viewDidLoad</em>メソッドをオーバーライドすればそのタイミングで処理できる。</li>
</ul>
<h4>アプリケーションのテスト</h4>
<p>ここまでDelegateと、テンプレートで生成したViewControllerしかつくっていないが、正しく動くかどうかを確認するために、Viewの背景色を変えてみる。Interface Builder でViewオブジェクトのattributeからBackgroundを変更して動かしてみる。シミュレータの画面にも反映されてるのがわかったら元に戻しておく。</p>

</div>
<div class="section">

<h3>Viewの設定</h3>
<h4>インターフェイス要素の配置</h4>
<p>View(の画面）に部品を配置する。</p>
<p>Interface Builder でテキスト(UITextField)、ラベル(UILabel)、ボタン(UIButton)を配置する。最初にするのは</p>
<dl>
<dt>テキストフィールド</dt>
<dd>幅を広げて、初期文字列を設定する(<em>「Placeholder」</em>属性似文字列を設定する)
</dd>
<dt>ラベル</dt>
<dd>デフォルトの文字を消す。また、<em>「Clear Context Before Drawing」</em>チェックをつけておく。これをつけないと文字を買えたときでも前の文字に重ね打ちしてしまう。
</dd>
<dt>ボタン</dt>
<dd>ボタンのラベルを"Hello"に変更する。
</dd>
</dl>
<p>テキストフィールドは他にもいくつか設定しておくことがある。</p>
<ul>
<li>入力した名前の先頭が大文字になるようにする「Capitalize」を「Words」に</li>
<li>入力欄にひも付いたキーボードを名前用のコンテキストにする「Keyboard」を「Default」に</li>
<li>キーボードに「Done」(確定)が表示されるようにする。「Return Key」を「Done」に</li>
</ul>
<pre>※今回は入力方法が決まっているのでInterface Bulderの作業だけでよい(プログラムが動的に制御する必要がない）</pre>
<p>上の設定によって、テキストフィールドでタップするとキーボードがでるようになる。ただし今は閉じる処理がない。</p>
<pre>※なお、地域設定もまだいじってないのでキーボードは日本語モードに切り替えることができない。</pre>
<h4>View Controllerのインターフェイス宣言</h4>
<pre>MyViewController.hのソース
#import &lt;UIKit/UIKit.h&gt;

@interface MyViewController : UIViewController  &lt;UITextFieldDelegate&gt; {
UITextField*textField;
UILabel*label;
NSString*string;
}

@property (nonatomic, retain) IBOutlet UITextField *textField;
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (nonatomic, copy) NSString *string;

- (IBAction)changeGreeting:(id)sender;

@end</pre>
<p>ポイント</p>
<ul>
<li>画面項目のテキストフィールド、ラベルと、出力のための文字列をインスタンス変数として宣言</li>
<li>併せて@property定義もする(setter/getterの定義やオブジェクトのメモリ管理方法を指定）。</li>
<li>画面のインターフェース要素であるテキストフィールドとラベルは、<em>「IBOutlet」</em>を指定する。これはコンパイルしても消えるがInterface Bulderに対して Outlet 項目を教えることができる。(※Interface Builder はInterfaceを見て動作する）</li>
<li>ボタンを押したときに動くメソッド<em>「changeGreeting:」</em> を宣言し、Interface Builderに「Target-Action」のActionであることを教えるために<em>「(IBAction)」</em> を記述する。Objective-C上は(void)となる。</li>
</ul>
<h4>接続の設定</h4>
<p>Interface Builder でつくったViewの画面とクラスを接続させる。
「File's Owner」を選択してControl+クリックすると接続の一覧がでるので、それぞれ接続する。</p>
<ul>
<li>File's OwnerのOutlet「view」をViewへ()</li>
<li>labelはInterface Builderのラベル部品へ</li>
<li>textFieldsは画面のテキストフィールドへ</li>
</ul>
<pre>※nibファイル側の画面部品に名前がついていてその名前で画面項目にアクセスするのではなく、画面部品には名前がないけどもViewControllerのOutlet(インスタンス変数）と画面部品をひも付けているので、アプリはインスタンス変数を読み書きするだけでよい。</pre>
<p>
ちなみに一覧を出さなくても、「File's Owner」から線を延ばして「テキストフィールド」で選択すると、オブジェクトの型が一致している<em>「textField」</em>しか選択肢に出てこないので、こっちからでもよい。(一覧を出した方が、接続状況がわかりやすいけど）(図はテキストフィールドに対して、ViewControllerのOutletのどの項目を接続するかを選択している場面）

</p>
<p>

ボタンからアクションにつなぐには、ボタンを選択してからControl+クリックで接続一覧をだして<em>「Touch Up Inside Events」</em>から「File's Owner」に接続させる(ボタン→File's Owner）(ボタンから手を離したときに発生するイベント）

</p>
<p>
</p>
<pre>※ガイドでは上の説明になっていたが、ボタンイベントであれば（ボタン側の接続一覧を出さなくても）ボタンから「File's Owner」に線を延ばして、「Events」の選択肢からメソッド名(changeGreeting)を選べば早いはず。</pre>
<p>なおキーボードで Retun を押すと(タップすると）、Delegateにそのイベントが来るのでそのタイミングでキーボードを閉じればよい(その処理は後述）。
ここでは、テキストフィールドのOutlet「delegate」を「File's Owner(つまりMyViewController)」に接続することでDelegateを設定しておく。</p>

</div>
<div class="section">

<h3>View Controllerの実装</h3>
<h4>プロパティの実装</h4>
<p>インターフェースで@property宣言をしていた変数を実装する。つまり@synthesizeして、アクセッサを生成させる。</p>
<pre>@synthesize textField;
@synthesize label;
@synthesize string;</pre>
<p>また、@propety宣言の際にいずれも <em>retain</em>または<em>copy</em>の所有権を持つ指定にしていたため、最後にメモリを解放する必要がある。deallocメソッドに処理を追加する。</p>
<pre>- (void)dealloc {
    [textField release];
    [label release];
    [string release];
    [super dealloc];
}</pre>
<h4>changeGreetingメソッド</h4>
<p>ボタンをタップするとView Controllerに <em>changeGreeting:</em>メソッドを送ってくるので(Interface Builderでそう設定したから）、メソッドの中身を実装する。テキストフィールドに入力された文字列を使ってラベルを更新する。</p>
<p>テキスト入力があれば「Hello, + 入力 + !」を、なければ「Hello, World!」を表示する。</p>
<pre>- (IBAction)changeGreeting:(id)sender {

    // テキストフィールドに入力文字列をコピーする
    self.string = textField.text;

    NSString *nameString = string;

    if ([nameString length] == 0) {
        nameString = @"World";
    }

    // initWithFormat:を使って書式整形する。空のallocがいるのはちょっと面倒くさい
    NSString *greeting = [[NSString alloc] initWithFormat:@"Hello, %@!", nameString];

    label.text = greeting;

    [greeting release];
}</pre>
<p>テキストフィールドの内容は必ず自分のインスタンス変数にコピーすること。<em>「一般に、コントローラは、アプリケーショ ンデータを、固有のModelオブジェクト内に保持しなければなりません。アプリケーションデー タをユーザインターフェイス要素内に格納してはいけません。」</em>とのこと。</p>
<h4>キーボードを閉じる（テキストフィールドのDelegate)</h4>
<p>いまのままでは<em>changeGreeting:</em>が呼ばれてもキーボードを閉じることが出来ない。</p>
<p>iOSでは、<strong>テキストフィールドが「ファーストレスポンダ(first responder)」になっているときにキーボードが表示され</strong>、そうでなくなると閉じられるようになっている。キーボードと直接通信する方法はないが、ファーストレスポンダ状態を変えればキーボードを閉じることはできる。</p>
<blockquote><p>ファーストレスポンダについては<a href="http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html">iOS Application Programming Guide</a>の"「The Event-Handling System」"参照。</p>
</blockquote>
<p><em>UITextFieldDelegate</em>プロトコルは、「Done」が押されたときにテキストフィールド（のDelegate)を呼び出す<em>textFieldShouldReturn:</em>を用意している。MyViewControllerは <em>UITextFieldDelegate</em>に対応させているしInterface Builderでもテキストフィールドのdelegateとして接続してあるので、呼んでもらえる。</p>
<p><em>textFieldShouldReturn:</em>メソッドが呼ばれたら、テキストフィールドに<em>resignFirstResponder</em>メッセージを送ることによって、ファーストレスポンダでは無くなるようにできる。</p>
<pre>- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {

    if (theTextField == textField) {
        [textField resignFirstResponder];
    }
    return YES;
}</pre>
<p>このアプリではテキストフィールドは１つしかないのでイベント送信元をチェックする必要はないが、一般的には処理対象オブジェクトか確認する必要がある。</p>
<p>※サンプル自身はここで完成。</p>

</div>
<div class="section">

<h3>つぎにすることは？</h3>
<h4>ユーザーインターフェース要素をプログラムで作成する</h4>
<p>上の例ではユーザーインターフェース要素をすべてInterface Builderで作成したが、実際にはプログラム内で制御することも多い。
うえのテキストボックスを仮にプログラムで生成した場合を示す。</p>
<h5>Interface BuilderでMyViewController.xibのView画面からテキストフィールドを削除する。</h5>
<h5>Viewに対してテキストフィールドのViewをサブビューとして追加する</h5>
<p><em>viewDidLoad</em>メソッドをオーバーライドして、nibファイルからのview(ラベルとボタンは残っている）のロード後にテキストを追加する。</p>
<p>以下のような処理。</p>
<pre>- (void)viewDidLoad {
    // テキストフィールドサイズを指定して生成
    CGRect frame = CGRectMake(20.0, 68.0, 280.0, 31.0);
    UITextField *aTextField = [[UITextField alloc] initWithFrame:frame];
    self.textField = aTextField;
    [aTextField release];

    textField.textAlignment = UITextAlignmentCenter; //Textアライメント設定
    textField.borderStyle = UITextBorderStyleRoundedRect; //テキストフィールドのかどを丸く(IBで選んだときと同じにする）

    textField.autocapitalizationType = UITextAutocapitalizationTypeWords; // IBで設定したCapitalize属性
    textField.keyboardType = UIKeyboardTypeDefault; // IBで設定したKeybord type属性
    textField.returnKeyType = UIReturnKeyDone; // IBで設定したReturn Key属性

    textField.delegate = self; // 前はTextFiedのDelegateをViewControllerに接続していたので同様に自分を指定。

    [self.view addSubview:textField]; // サブビューとしてテキストフィールドを追加
}</pre>
<h4>機能を追加する</h4>
<ul>
<li>iOSならではのtouchイベントに対応して描画するカスタムビュー。<a href="http://developer.apple.com/library/ios/#samplecode/MoveMe/Introduction/Intro.html">MoveMeサンプル</a>(ソース)(<a href="CreatingAniPhoneApplication">説明</a>)や、「Metronome」<a href="http://developer.apple.com/library/ios/#samplecode/Metronome/Introduction/Intro.html">ソース</a>参照。</li>
<li>Table View を使うと要素が増えたらスクロールする画面が簡単に作れる。<a href="http://developer.apple.com/library/ios/#samplecode/TableViewSuite/">TableViewSuite</a>サンプルを参照。(<a href="http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/AboutTableViewsiPhone/AboutTableViewsiPhone.html">Table View Programming Guide for iOS</a>)</li>
<li>Navigation ControllerやTab Bar Controllerを使うのもよい。Navigation Controllerのサンプルは<a href="http://developer.apple.com/library/ios/#samplecode/SimpleDrillDown/Introduction/Intro.html">SimpleDrillDown</a>サンプル参照。(<a href="http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html">View Controller Programming Guide for iOS</a>)</li>
<li>ローカライズについては <a href="http://developer.apple.com/library/ios/#documentation/MacOSX/Conceptual/BPInternational/BPInternational.html">Internationalization Programming Topics</a>参照</li>
</ul>

</div>
<div class="section">

<h3>リファレンス</h3>
<ul>
<li>インスタンスの保持・release対象について"<a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html">Memory Management Programming Guide</a>" の "<a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html">Object Ownership and Disposal</a>"</li>
<li>Cocoaのデザインパターン"<a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html">Cocoa Fundamentals Guide</a>" の "<a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html">Cocoa Design Patterns</a>"</li>
<li>nibファイルで管理しているオブジェクト"<a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html">Resource Programming Guide</a>" 参照。</li>
</ul>
<hr>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://different-view.jp/~vette/108/swift/?date=20141021">
<title>Swift Blog</title>
<link>http://different-view.jp/~vette/108/swift/?date=20141021</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://different-view.jp/~vette/108/swift/?date=20141021" />
<dc:creator>vette</dc:creator>
<dc:date>2014-10-21T10:05:25+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>本文です</p>

</div>
<p></p>
]]></content:encoded>
</item>
</rdf:RDF>
