KVO with two UIButtons
<p>I have a custom UITableViewCell subclass that gets presented in a UITableView in a UIPopoverController.  The UIPopoverController is presented from a UIBarButtonItem.</p>

<p>When selections in the UITableViewCell are made, I send a NSNotification to the UIViewController class that is presenting the UIPopoverController.  The selections in the table update my view in my viewController.  </p>

<p>Now, there is a requirement to have another UIBarButtonItem that does EXACTLY the same thing as one of the buttons in the UITableViewCell in the popover.  Basically the use case is that this feature seems to be the most commonly used feature in our popover and they want an easy way to just turn it on and off from another button.</p>

<p>So what I did was create a new UIBarButtonItem, and have a target attached to it: </p>

<pre><code>- (void)FilterOn:(id)sender {
    isFilterOn = !isFilterOn;
    if ([sender isKindOfClass:[UIBarButtonItem class]]) {
        UIBarButtonItem *filter = (UIBarButtonItem *)sender;
        if (isFilterOn) {
            [filter setTitle:@"Filter On"];
            [self DoFilter];
        }
        else {
            [aboutMeBBI setTitle:@"Filter Off"];
            [self ClearFilter];
        }

    }
}
</code></pre>

<p>So this part works.  It updates the model, the title of the button changes.  The problem is, let's say I turn filter on, then in the popover, I turn the filter off.  I pass the notification to my viewController class to its normal update method that handles filtering and a bunch of other stuff.  I added this simple snippet to when the filter button is pressed from the popover:</p>

<pre><code>- (void)FilterSortOptionDidSelect:(NSNotification *)notification {
    NSDictionary *userDict = [notification userInfo];
    NSInteger theTag = [[userDict objectForKey:@"CellTag"] integerValue];

    switch (theTag) {
        case FILTER: {
                // update Model
                [self.FilterBarButtonItem setTitle:@"Filter off"];
            }
            break;
        default:
            break;
    }
}
</code></pre>

<p>This isn't quite what I want though since if I click back on the filter button since for starters, if I click back on the Filter button, it'll still say Filter Off, and do the action for Filter Off, and then if I click it again, it'll do Filter on actions.  I try to fake it in the switch statement by changing the title, but that isn't really what I want to do.  I read a little about key value observing and I wasn't sure if I could use something like that here, to register my buttons state with that of a button in a UITableViewCell subclass in a UIPopoverController.  If anyone has any ideas that would be great.  Thanks.</p>
