I work on a project for iPhone iOS4 with Xcode.
From MainViewController I want to draw a little red square (fill only, not stroke) in MyView, a subclass of UIView. How can I pass position and RGB color of the square?
MyView.h (subclass of UIView)
@interface {
CGPoint position; // OK
CGFloat[3] color; // ???
}
@property CGPoint position; // OK
@property CGFloat color; // ???
MyView.m
@synthesize position; // OK
@synthesize color; // ???
MainViewController.h
MyView *myRect;
property IBOutlet MyView *myRect;
MainViewController.m
@synthesize myRect;
- (void) viewDidLoad
myRect.position = CGPointMake (0, 0); // OK
myRect.color = CGFloat [] = {255, 0, 0, 1} // ???
I think I have no problems with the position of the square. But how can I pass the color of the square?
Thank you.
1 Answer