I don't know the context of your problem (ie. what are you trying to do), but another approach to your problem may involve using Key Value Observing to observe changes to your text view background color, and act accordingly.
Here's some documentation to get you started with KVO.
In code:
static void * kBackgroundColorCtx = &kBackgroundColorCtx;
[self.myTextView addObserver:self
forKeyPath:@"backgroundColor"
options:NSKeyValueObservingOptionOld
context:kBackgroundColorCtx];
Then, in your view controller implement this:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if (context == kBackgroundColorCtx) {
NSLog(@"Background color changed from %@ to %@",
[change objectForKey:NSKeyValueChangeOldKey],
self.myTextView.backgroundColor);
} else {
// Not interested in this, pass to superclass
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}