3 ms·
UITextField is a good example - http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextField_Class/Reference/UITextField.html http://develo
by seanalltogether 16y ago
UITextField is a good example - http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextField_Class/Reference/UITextField.html http://developer.apple.com/library/ios/#documentation/uikit/...
There are 7 delegate callbacks, 2 of which are voids so they're not really delegation methods.
There is also a large list of UIControlEvents also sent around value change and touch events.
Lastly 3 NSNotifications can also be dispatched by this object when data changes.
Some of the list components are equally bad. The rule of thumb for ideal delegate vs event models is this. If you need a value returned, it should be a delegate method
- (UIView )viewForZoomingInScrollView:(UIScrollView )scrollView
but if a callback returns no data, it should not be a delegate but rather an event
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
there is no reason for a void method to only allow for one listener and it's bad design.