Challenge met...or not?


#1

I’ve got the challenge exercise working. However, (with HeavyRotation active) if I rotate my iPhone to landscape and then put my hand over it, no proximity notifications occur. Is this expected, or am I missing something?

I added this to HeavyRotationAppDelegate.m: -applicationDidFinishLaunching:

	// Turn on proximity monitoring
	[device setProximityMonitoringEnabled:YES];
	[nc addObserver:self selector:@selector(proximityChanged:) name:UIDeviceProximityStateDidChangeNotification object:device];

I implemented the method in HeavyRotationAppDelegate.m:

- (void)proximityChanged:(NSNotification *)note {
	BOOL proximityState = [[note object] proximityState];
	NSLog(@"proximityChanged: %d", proximityState);
	[(HeavyViewController *)[[self window] rootViewController] changeColor:proximityState];
}

And this is the method I implemented in HeavyViewController.m:

- (void)changeColor:(BOOL)state {
	if (state) {
		[[self view] setBackgroundColor:[UIColor darkGrayColor]];
	} else {
		[[self view] setBackgroundColor:[UIColor whiteColor]];
	}
}

#2

I haven’t seen it in Apple’s documentation, but comments on StackOverflow noted this to be the case. (I didn’t receive the notification in landscape mode either.)