I couldn't get the NSNotification to work for the accessibility feature where you invert the screen
I asked this question on stackOverflow:
I am not sure if this is an iOS 7 bug or what. But..I cannot get the UIAccessibilityInvertColorsStatusDidChangeNotification to work.
So when I init my nib I do this:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(inverted)
name:UIAccessibilityInvertColorsStatusDidChangeNotification
object:nil];
}
return self;
}
Later in my code I have the notification:
- (void)inverted {
if(UIAccessibilityIsInvertColorsEnabled()) {
NSLog(@"setting tintcolor to cyan");
self.view.tintColor = [UIColor cyanColor];
[self tintColorDidChange];
} else {
NSLog(@"setting tintcolor to red");
self.view.tintColor = [UIColor redColor];
[self tintColorDidChange];
}
}
However when my app is running and I change the Invert Colors mode via tripple-tap on the home button, nothing happens in the app. Don't get a message on console, don't get a change of tintColor, don't get nothin'.
I tested this on iOS 6 and iOS 7. I tried setting my build target for iOS 6.1 instead of 4.3 and that didn't fix it either.
I tried adding -(void)inverted; to my interface and that didn't fix it. I tried adding the colon after inverted but that didn't fix it either, and the docs say that this notification doesn't have an argument anyway.
Obviously I'm doing something wrong. What? Thanks in advance.
No comments:
Post a Comment