ReactiveCocoa/ReactiveCocoa — pull request #745 by justbuchanan (2013-08-13 01:18:44+00:00)
Title: Fix RACSignalSupport to reset delegate after dynamically adding methods

When you set the delegate of a UIKit class, the delegate gets asked if it responds to each of the optional methods in the delegate protocol. The UIKit class caches these in instance variables, so the delegate is asked only once (at the time it is set as the delegate) whether or not it implements optional protocol methods.

I used the following code for to present an action sheet:
```objective-c
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"Sheet"
delegate:nil
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Destroy"
otherButtonTitles:nil];
[sheet.rac_buttonClickedSignal subscribeNext:^(NSNumber *idx) {
NSLog(@"button %@ clicked", idx);
}];

[sheet showInView:myView]
```
When I click on a button, the log message is never printed.

The issue is that the actionSheet:clickedButtonAtIndex: method is added to the delegate proxy by ReactiveCocoa *after* the sheet's delegate has been set to a RACDelegateProxy. When I click on a button on the action sheet, it checks its previously cached list of what optional methods the delegate responds to, sees that the delegate doesn't (didn't at the time of setting) implement actionSheet:clickedButtonAtIndex:, and never calls the method on the delegate.

I've fixed this by reordering so that the method is now added to the delegate proxy *before* the proxy is set as the sheet's delegate. This fix also applies to UIAlertView and UITextView.