Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page >

パッチコントローラを設定する

QCPatchControllerを使用して、ユーザインターフェイスコントロールとコンポジションとの間でCocoaバインディングを確立できます。CocoaのModel-View-Controller (MVC)パラダイムにおいては、QCPatchControllerはコンポジション(モデル)とQCView(ビュー)との間のコントローラとして動作します。MVCパラダイムの詳細については、『Cocoa Application Tutorial』を参照してください。

このセクションでは、グローキューブコンポジションのClear Color入力ポートとPower入力ポートをすでに公開していることを前提とします。以下の手順に従ってパッチコントローラを設定します。

  1. Interface Builderを起動し、Cocoaウインドウ書類を新規作成します。

  2. QCViewをQuartz Composerパレットからウインドウにドラッグします。

  3. Figure 4-5に示すように、QCPatchControllerをQuartz Composerパレットからnibファイルウインドウの「Instances」ペインにドラッグします。


    Figure 4-5  QCPatchControllerをnibファイルにドラッグする

    Dragging a QCPatchController to a nib file
  4. パッチコントローラを選択し、「Inspector」ウインドウの「Attributes」ペインを開きます(Figure 4-6を参照)。


    Figure 4-6  QCPatchControllerの「Attributes」ペイン

    The Attributes pane for QCPatchController
  5. 「Load from Composition File」をクリックし、前のセクションで変更を加えたグローキューブコンポジションを選びます。

  6. QCViewを選択し、「Inspector」ウインドウの「Bindings」ペインを開きます。

  7. 「patch」の横にある公開三角形をクリックします。

  8. 「Bind to」ポップアップメニューから「QCPatchController」を選びます。

  9. 「Controller Key」テキストフィールドにpatchと入力し、patchプロパティをQCPatchControllerのpatchキーにバインドします。

    これで、QCPatchControllerに読み込まれるコンポジションにQCViewがバインドされ、QCViewによってこのコンポジションがレンダリングされます。

  10. 「File」>「Test Interface」を選びます。

    グロー表示の回転キューブがウインドウに表示されます。

  11. インターフェイステストアプリケーションを終了します。

注:  QCViewのpatchプロパティをバインドするとき、コンポジションがQCViewに確実にロードされていない状態にすることができます。これには、QCView用のInspectorの「Attributes」ペインにある「Unload」ボタンをクリックします。

次のセクションでは、インターフェイスにコントロールを追加し、コンポジションのルートマクロパッチの入力との間にバインディングを設定します。



< Previous PageNext Page >


Last updated: 2006-12-05




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice