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

< Previous PageNext Page >

タイマーを作成する

コンポジションの規則的なレンダリングを実行するためにタイマーを設定する必要があります。次のコードで設定されるタイマーは、毎秒60回発行されるようにスケジューリングされます。タイマーが発行されるたびに、次のセクションで作成するレンダリングルーチンが呼び出されます。タイマーを作成できない場合は、アプリケーションを終了する必要があります。そのため、タイマーの存在を確認するコードを必ず含めます。

#define kRendererFPS 60.0
 
_renderTimer = [[NSTimer scheduledTimerWithTimeInterval:(1.0 /
                                (NSTimeInterval)kRendererFPS)
                        target:self
                        selector:@selector(_render:)
                        userInfo:nil
                        repeats:YES]
                        retain];
if(_renderTimer == nil)
    {
        NSLog(@"Cannot create NSTimer");
        [NSApp terminate:nil];
    }


< 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