I have a utility app for drawing.
In the xib there is a button that when pressed should update the UIImage variable.
- (IBAction)changeImage {
UIImage *drawImageVar = [UIImage imageNamed:@"line.png"];
That line is in the MainViewController.m file.
The code that uses the drawImageVar is in the MainView.m as part of the
- (void) drawRect:((CGRect)rect {
I don’t get any errors when it runs in the simulator, but it doesn’t do anything.
BUT…
I have a yellow warning in the MainViewController.m file that says ..
Unused variable ‘drawImageVar
I assumed that it’s not being seen globally by and tried other suggestions for making it global(singleton, putting variable in the AppDelegate), but non of that seems to work.
Any advice??
YOUr drawImageVar is a local variable. You have to make it global or use the global variable instead