#import "PolygonShape.h" @interface CustomView : UIView { IBOutlet PolygonShape *polygon; } - (NSArray *)pointsForPolygonInRect:(CGRect)rect numberOfSides:(int)numberOfSides; @end #import #import #import "PolygonShape.h" #import "PolygonView.h" @interface Controller : NSObject { IBOutlet UIButton *decreaseButton; IBOutlet UIButton *increaseButton; IBOutlet UILabel *numberOfSidesLabel; IBOutlet PolygonShape *polygon; IBOutlet PolygonView *polygonView; } - (IBAction)decrease; - (IBAction)increase; - (void)awakeFromNib; - (void)updateInterface; @end #import "PolygonShape.h" @interface CustomView : UIView { IBOutlet PolygonShape *polygon; } @property (readwrite, assign) PolygonShape *polygon; - (NSArray *)pointsForPolygonInRect:(CGRect)rect numberOfSides:(int)numberOfSides; @end @implementation CustomView @synthesize polygon; ... @end - (void)awakeFromNib { // configure your polygon here polygon = [[PolygonShape alloc] initWithNumberOfSides:numberOfSidesLabel.text.integerValue minimumNumberOfSides:3 maximumNumberOfSides:12]; [polygonView setPolygon:polygon]; NSLog (@"My polygon: %@", [polygon description]); }