• 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: nibs don't respect protocols
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nibs don't respect protocols


  • Subject: Re: nibs don't respect protocols
  • From: Christiaan Hofman <email@hidden>
  • Date: Thu, 3 Jun 2010 23:49:02 +0200


On Jun 3, 2010, at 23:41, Jonathan Hess wrote:


On Jun 2, 2010, at 2:18 PM, Christiaan Hofman wrote:


On Jun 2, 2010, at 20:27, Matt Neuburg wrote:

I'm moving this over from Cocoa-Dev, so if you have the feeling you've seen
this before, that's why.

I'm struck by the following sort of situation. A UIApplication's delegate
property is defined as an id <UIApplicationDelegate>. But if I hook up the
UIApplication proxy object in a nib to another instance as its delegate, and
if that other instance does _not_ formally adopt UIApplicationDelegate,
there seems to be no penalty: the nib doesn't complain, and the app runs
fine.

So... Are nibs just ignorant of protocols? This feels like a bug. If you try
to hook up an outlet to the wrong type (e.g. a UILabel instead of a declared
UITextField), you can't; Interface Builder won't let you. Well, a class that
doesn't declare conformance to UIApplicationDelegate *is* the wrong type for
UIApplication's delegate; yet Interface Builder *does* let you. In that
case, what's the point of having the protocol at all?


IB is indeed not checking protocols, only classes. Note that IB is ignorant in more ways, for instance it also does not know about informal categories in separate files.

If you have an alternate header file with:

@interface MyClass(ExtraActions)
- (IBAction)myExtraAction:(id)sender;
@end

IB will allow connections to "myExtraAction:" on instances of MyClass. Is that what you meant?

Jon Hess

Ah, then they fixed that finally, it sure failed to do that before.

Christiaan

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >nibs don't respect protocols (From: Matt Neuburg <email@hidden>)
 >Re: nibs don't respect protocols (From: Christiaan Hofman <email@hidden>)
 >Re: nibs don't respect protocols (From: Jonathan Hess <email@hidden>)

  • Prev by Date: Re: nibs don't respect protocols
  • Next by Date: Re: Running without the debugger
  • Previous by thread: Re: nibs don't respect protocols
  • Next by thread: Install path setting for dylibs in /usr/local/lib?
  • Index(es):
    • Date
    • Thread