2012-05-11 5 views
1

私はNSNotificationCenterを介して開始通知と停止通知を送信してアニメートするNSImage内にNSViewを作成しました。簡単にNSImageをアニメーション化できますか?

これを実現するにはどのような方法が必要ですか?

私が持っているコードは次のとおりです。

@implementation SyncToolbarItemView 

- (id)init 
{ 
    self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)]; 
    if (self) 
    { 
     // Initialization code here. 

     // Add observers 
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startSyncing) name:NOTIFICATION_START_CHECK_TAG_PROCESS object:nil]; 
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopSyncing) name:NOTIFICATION_FINISHED_CHECK_TAG_PROCESS object:nil]; 
    } 

    return self; 
} 

- (void)drawRect:(NSRect)dirtyRect 
{ 
    // Init image 
    img_sync = [[NSImageView alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 32.0f, 32.0f)]; 
    [img_sync setImage:[NSImage imageNamed:@"icon_sync.png"]]; 

    // Add to view 
    [self addSubview:img_sync]; 

    [img_sync release]; 
} 

- (void) startSyncing 
{ 

} 

- (void) stopSyncing 
{ 

} 

@end 

答えて

関連する問題