• 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: Cocoa class extension best practice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa class extension best practice


  • Subject: Re: Cocoa class extension best practice
  • From: Dave <email@hidden>
  • Date: Wed, 16 Oct 2013 20:04:05 +0100

Hi,

Out of interest, have you tried doing this:

- (NSMenuItem*)itemWithTag:(NSInteger)tag searchSubmenus:(BOOL)searchSubmenus depthFirst:(BOOL)depthFirst
{
NSMenuItem* 	item;				//*****
NSArray* 		myArray;			//*****
NSMenuItem*	subitem;				//*****

   if(!depthFirst) {
       id		item = [self itemWithTag:tag];

       if(item)
           return item;
   }

   if(searchSubmenus)
	{
	myArray = [self itemArray];			//******
       for( item in myArray])
	{
           if([item hasSubmenu])
		 {
		subitem = [[item submenu] itemWithTag:tag searchSubmenus:searchSubmenus depthFirst:depthFirst];

               if(subitem)
                   return subitem;
          	 }
       }
   }

   return [self itemWithTag:tag];
}

I doubt it will make any difference, but I've had problems with definining variable in the for/in statement before.

Cheers
Dave


_______________________________________________

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: 
 >Cocoa class extension best practice (From: Steve Mills <email@hidden>)
 >Re: Cocoa class extension best practice (From: Kyle Sluder <email@hidden>)
 >Re: Cocoa class extension best practice (From: Steve Mills <email@hidden>)
 >Re: Cocoa class extension best practice (From: Graham Cox <email@hidden>)
 >Re: Cocoa class extension best practice (From: "Mills, Steve" <email@hidden>)
 >Re: Cocoa class extension best practice (From: Graham Cox <email@hidden>)
 >Re: Cocoa class extension best practice (From: Steve Mills <email@hidden>)
 >Re: Cocoa class extension best practice (From: Jens Alfke <email@hidden>)
 >Re: Cocoa class extension best practice (From: Ken Thomases <email@hidden>)
 >Re: Cocoa class extension best practice (From: Steve Mills <email@hidden>)
 >Re: Cocoa class extension best practice (From: Ken Thomases <email@hidden>)
 >Re: Cocoa class extension best practice (From: Steve Mills <email@hidden>)

  • Prev by Date: CFPreferencesAppSynchronize() "looping synchronize attempt"
  • Next by Date: Re: CFPreferencesAppSynchronize() "looping synchronize attempt"
  • Previous by thread: Re: Cocoa class extension best practice
  • Next by thread: Re: Cocoa class extension best practice
  • Index(es):
    • Date
    • Thread