• 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: User interface validation doesn't work, right?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User interface validation doesn't work, right?


  • Subject: Re: User interface validation doesn't work, right?
  • From: Michael Ash <email@hidden>
  • Date: Thu, 2 Jul 2009 12:42:07 -0400

On Thu, Jul 2, 2009 at 3:48 AM, Bill Cheeseman<email@hidden> wrote:
> I did find it confusing when I read the NSMenuItem and NSToolbarItem Class
> Reference documents, which say that they conform to the other protocol, the
> NSValidatedUserInterface protocol. But this tends to suggest that NSButton
> will work, too, since NSControl, from which NSButton inherits, also conforms
> to the NSValidatedUserInterface protocol. It doesn't say so, but Apple's
> documentation has a long history of neglecting to mention all the protocols
> that a class conforms to. I was able to confirm from the NSControl Class
> Reference document, and you can too, that NSControl does implement the
> -action and -tag methods required by the NSValidatedUserInterface protocol.
> So, again, I don't understand why you say it doesn't.

Because it doesn't.

You seem to think that protocol conformance is simply a matter of
having declared the proper methods. That's not how it works. If you
check with -conformsToProtocol:, it will return NO. If you try to
assign to a pointer of type id <NSValidatedUserInterface> the compiler
will warn you.

Protocol conformance is a matter of having the declaration in the
header. Nothing else counts. Especially here, where the protocol is
obviously being used as a way to claim a particular behavior, not just
an ability to respond to certain selectors.

As proof, I submit NSObject and NSCopying. NSCopying contains a single
method, -copyWithZone:. NSObject implements this method. And yet,
NSObject does not conform to NSCopying, and if you try to copy one it
will fail.

Mike
_______________________________________________

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: 
 >Re: User interface validation doesn't work, right? (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: Sorting on a table view of a managed object - debugger throws exception
  • Next by Date: Re: NSTableView bug?
  • Previous by thread: Re: User interface validation doesn't work, right?
  • Next by thread: Re: User interface validation doesn't work, right?
  • Index(es):
    • Date
    • Thread