• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: superview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: superview


  • Subject: Re: superview
  • From: Conrad Shultz <email@hidden>
  • Date: Sun, 08 May 2011 18:09:03 -0700

-----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 <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >superview (From: Nelson Hazeltine <email@hidden>)
 >Re: superview (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: superview
  • Next by Date: what should I understand from kAudioQueueProperty_CurrentLevelMeterDB
  • Previous by thread: Re: superview
  • Next by thread: Re: superview
  • Index(es):
    • Date
    • Thread