I am using a UIView object that simply sets the background color to blue. This works fine the first time the code runs, but running the changeBackgroundColor mehod again (from a button action) doesnt change the color to red, even though debugging the code clearly shows the method runs as expected.
Please could someone explain why the view color doesnt update?
Header:
@interface colorClass : NSObject {
UIView *myView;
}
@implementation
...
-(UIView *)changeBackgroundColor {
myView = [[UIView alloc] initWithFrame:CGRectMake(100, 0, 500, 245)];
static int counter = 1;
if (counter++ %2){
[mediaView setBackgroundColor:[UIColor blueColor]];
}else {
[mediaView setBackgroundColor:[UIColor redColor]];
}
return myView;
}