Hello there!
I had asked a question similar to this before, but I have a new problem with it so I've reposted part of the question.
I have this before the interface declaration in my MainView.h
header.
typedef enum { UNKNOWN, CLEAR, NIGHT_CLEAR, CLOUDY, NIGHT_CLOUDY } Weather;
Then I declared it (in my MainView) like this:
Weather weather;
Then made an accessor (and synthesized it):
@property Weather weather;
My question is, how can I use this in MainViewController
without it crashing? I've imported the header for MainView.
I tried to use it like this:
MainView* myView = (MainView*)self.view;
[myView setWeather: CLEAR];
It doesn't throw me any errors in Xcode, but it crashes when the code is run, saying:
-[UIView setWeather:]: unrecognized selector sent to instance *blah*
Am I doing something wrong here?
In my MainViewController:
- (void)viewDidLoad {
[super viewDidLoad];
MainView * drawBox = [[MainView alloc] initWithFrame:(CGRectMake(60, 80, 200, 200))];
drawBox.backgroundColor = [UIColor clearColor];
[self.view addSubview:drawBox];
}