• 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: Editing nib files in XCode 4 and other stuff
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editing nib files in XCode 4 and other stuff


  • Subject: Re: Editing nib files in XCode 4 and other stuff
  • From: Eli Bach <email@hidden>
  • Date: Sat, 30 Apr 2011 14:04:29 -0600

On Apr 30, 2011, at 10:33 AM, John Love wrote:

> I've just converted my long-standing XCode 3 project to XCode 4.  I was very fortunate in that the only change I had to make was because the call to -setDelegate was changed from:
>
> - (void )setDelegate:(id)delegate
> to:
> - (void )setDelegate:(id < NSToolbarDelegate >)delegate
> - (void )setDelegate:(id < RunPortDelegate >)delegate
>
> for one class's ToolbarCategory and for my RunPortCategory for another Class.
>
> (1) For what reason did they make that change to -setDelegate .. just plain ole (id) worked ??

Well, the class probably requires that the delegate implement all the methods of the specified protocol, so by adding the protocol to the declaration, the compiler can check and notify you if you try to set the delegate with an instance of a class that doesn't implement the given protocol.  In the worst case [where the instance is stored in an 'id' variable that's not easy to change to the actual class of the instance], you can just typecast it to the expected type [after making sure the instance does implement the protocol, of course].

Eli

_______________________________________________

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: 
 >Editing nib files in XCode 4 and other stuff (From: John Love <email@hidden>)

  • Prev by Date: Re: iOS internaltional dialing plan
  • Next by Date: Re: Editing nib files in XCode 4 and other stuff
  • Previous by thread: Editing nib files in XCode 4 and other stuff
  • Next by thread: Re: Editing nib files in XCode 4 and other stuff
  • Index(es):
    • Date
    • Thread