Created
May 12, 2012 16:33
-
-
Save C4Code/2667489 to your computer and use it in GitHub Desktop.
how to structure the init method of a custom shape class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// C4WorkSpace.m | |
// customShapeInit | |
// | |
// Created by Travis Kirton on 12-04-30. | |
// Copyright (c) 2012 POSTFL. All rights reserved. | |
// | |
#import "C4WorkSpace.h" | |
#import "MyShape.h" | |
@implementation C4WorkSpace | |
-(void)setup { | |
MyShape *ms = [MyShape new]; | |
[ms ellipse:CGRectMake(100, 100, 100, 100)]; | |
[self.canvas addShape:ms]; | |
} | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MyShape.h | |
// customShapeInit | |
// | |
// Created by Travis Kirton on 12-04-30. | |
// Copyright (c) 2012 POSTFL. All rights reserved. | |
// | |
#import "C4Shape.h" | |
@interface MyShape : C4Shape | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MyShape.m | |
// customShapeInit | |
// | |
// Created by Travis Kirton on 12-04-30. | |
// Copyright (c) 2012 POSTFL. All rights reserved. | |
// | |
#import "MyShape.h" | |
@implementation MyShape | |
-(id)initWithFrame:(CGRect)frame { | |
self = [super initWithFrame:frame]; | |
if(self != nil) { | |
self.animationDuration = 0.0f; | |
self.fillColor = [UIColor purpleColor]; | |
self.strokeColor = [UIColor greenColor]; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment