// // catsaverView.m // catsaver // // Created by mrphi on 27/11/13. // Copyright (c) 2013 42. All rights reserved. // #import "catsaverView.h" @implementation catsaverView - (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview { self = [super initWithFrame:frame isPreview:isPreview]; if (self) { [self setAnimationTimeInterval:0.07]; int a = 0; NSString *path; while (a < 35) { path = [NSString stringWithFormat:@"/Users/mrphi/Documents/catsaver/catsaver/img/%d.png", a]; self->img[a] = [[NSImage alloc] initWithContentsOfFile:path]; a += 1; } self->i = 0; } return self; } - (void)startAnimation { [super startAnimation]; } - (void)stopAnimation { [super stopAnimation]; } - (void)drawRect:(NSRect)rect { [super drawRect:rect]; } - (void)animateOneFrame { NSRect rect = NSMakeRect(0, 0, 2560, 1540); imageView = [[NSImageView alloc] initWithFrame:rect]; [imageView setImageScaling:NSScaleToFit]; NSImage *img_test = (img)[i]; [imageView setImage:img_test]; i += 1; if (i > 34) i = 0; [self addSubview:imageView]; return ; } - (BOOL)hasConfigureSheet { return NO; } - (NSWindow*)configureSheet { return nil; } @end