-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 5/8/11 5:37 PM, Kyle Sluder wrote: > On Sun, May 8, 2011 at 5:08 PM, Nelson Hazeltine <nhazelt...@sc.rr.com> wrote: >> Since the value of superview is the next responder (the receiver, most often >> a view controller in iPhone applications) > > Where did you get this idea? See the documentation for -[UIResponder > nextResponder]: > http://developer.apple.com/library/ios/documentation/uikit/reference/UIResponder_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006783-CH4-SW12
It seems likely the the OP generalized from Figure 1-1 at http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/EventsiPhoneOS/EventsiPhoneOS.html#//apple_ref/doc/uid/TP40009541-CH2-SW5 (or a similar diagram) and erroneously concluded that superview and nextResponder are synonymous. To answer the question I _think_ the OP is asking: UIView descends from UIResponder, not the other way around. Since a superview is always going to be a UIView, -superview returns UIView*, not the more general UIResponder*. Any superview can of course then, in principle, serve as nextResponder. But this is going to depend on how you linked up the responder chain, what is getting returned from -canBecomeFirstResponder, etc. _By default_ the superview is also nextResponder, but this can be changed, and often is. Quoting from the UIResponder docs for -nextResponder: "UIView implements this method by returning the UIViewController object that manages it (if it has one) or its superview (if it doesn?t)." On iOS the responder chain seems a little more locked down than on OS X since the former does not implement (publicly) the -setNextResponder method that is present in NSResponder. However, as noted in the UIResponder documentation, you certainly can override -nextResponder ("Subclasses must override this method to set the next responder") to insert objects into the responder chain yourself if needed. - -- Conrad Shultz Synthetiq Solutions www.synthetiqsolutions.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFNxz6vaOlrz5+0JdURAvRtAJ0S1oFE7lfk5qdA06kC/MV1yBr4iQCeLUwC aGavRlvCpVwt0Yeki64W4Z4= =yO/j -----END PGP SIGNATURE----- _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com