• 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: Disable toolbar items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disable toolbar items


  • Subject: Re: Disable toolbar items
  • From: Dave DeLong <email@hidden>
  • Date: Thu, 02 Dec 2010 20:53:13 -0800

I believe you have to implement the < NSUserInterfaceValidations > protocol.  There's a single method, and I've generally found the following to be satisfactory:

- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem>)anItem
  return [anItem isEnabled];
}

(Be sure to check if respondsToSelector:, etc)

Dave

On Dec 2, 2010, at 8:47 PM, email@hidden wrote:

> rather that deal with the remove of toolbar items I thought I would just disable the items with this code:
>
> NSArray *items = [m_toolbar items];
> NSEnumerator *e = [items objectEnumerator];
> NSToolbarItem *item;
> while(item = [e nextObject])
> {
> 	NSString *label = [item label];
> 	if(NSOrderedSame == [label compare:@"Merge Stitch File"] || NSOrderedSame == [label compare:@"Create Letters"])
> 	{
> 		[item setEnabled:NO];
> 		NSLog(@"disable %@",[item label]);
> 	}
> }
>
>
> I get this log output:
>
> 2010-12-02 21:44:04.392 Embrilliance[391:813] disable Merge Stitch File
> 2010-12-02 21:44:04.393 Embrilliance[391:813] disable Create Letters
>
> But, the items are still enabled.
>
> So, how does one disable a toolbar item?
>
> -koko
>
>
> _______________________________________________
>
> 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

_______________________________________________

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: 
 >Disable toolbar items (From: email@hidden)

  • Prev by Date: Re: [iOS] setting table style for root view controller of a navigation controller
  • Next by Date: Re: Disable toolbar items
  • Previous by thread: Disable toolbar items
  • Next by thread: Re: Disable toolbar items
  • Index(es):
    • Date
    • Thread