Just testing something out....I'm trying to get the background colour of my view to switch when I shake it....but only if it is currently a certain colour.
-(void)viewDidLoad{
self.view.backgroundColor = [UIColor whiteColor];
}
-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{
if(event.subtype == UIEventSubtypeMotionShake)
{
[self switchBackground];
}
}
-(void)switchBackground{
//I can't get the if statement below to evaluate to true - UIColor whiteColor is
// returning something I don't understand or maybe self.view.backgroundColor
//is not the right property to be referencing?
if (self.view.backgroundColor == [UIColor whiteColor]){
self.view.backgroundColor = [UIColor blackColor];
}
}