Desafio Bronze: Noficação de Proximidade

Quando uma notificação é postada, mude a cor de fundo de HeavyViewController.m

RotationAppDelegate.m

UIDevice *device = [UIDevice currentDevice];
[device setProximityMonitoringEnabled:YES];

// Set up an observer for proximity changes
[[NSNotificationCenter defaultCenter] addObserver:hvc selector:@selector(sensorStateChange:)
name
:@"UIDeviceProximityStateDidChangeNotification" object:device];

HeavyViewController.m

- (void)sensorStateChange:(NSNotificationCenter *)notification
{

if ([[UIDevice currentDevice] proximityState] == YES){
NSLog(@"Device is close to user.");
self.view.backgroundColor = [UIColor grayColor];
}else{
NSLog(@"Device is ~not~ closer to user.");
self.view.backgroundColor = [UIColor whiteColor];
}
}