• 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: Custom NSPredicateEditorRowTemplate with Single Item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom NSPredicateEditorRowTemplate with Single Item


  • Subject: Re: Custom NSPredicateEditorRowTemplate with Single Item
  • From: Steven Huey <email@hidden>
  • Date: Tue, 20 May 2008 07:34:47 -0400

Peter,

On May 19, 2008, at 6:58 PM, Peter Ammon wrote:

You're probably receiving this (admittedly opaque) error because you're not implementing the NSCopying protocol. Since a predicate editor can have multiple, identical rows, your templates are copied before their views are added to the predicate editor. If you subclass NSPredicateEditorRowTemplate and add a view to it, you must ensure that each copy has a new instance of the view.

I wasn't aware of that, but will keep that in mind since I have a few other custom templates to build.


However, there's an easier way to create a one-popup template:

- Select the row template in IB
- In the inspector, configure the row template to have whichever left expression type you want to have appear in your predicate (key paths or constant values).
- Double click on the popup in the template, and give it whatever title you want.
- Create a subclass of NSPredicateEditorRowTemplate, and override templateViews to only return the first view:


- (NSArray *)templateViews {
return [NSArray arrayWithObject:[[super templateViews] objectAtIndex:0]];
}


- In IB again, change the row template's class to your subclass.

This works perfectly, thanks! It hadn't occurred to me to just override templateViews and return just the first item, but I really like the approach.


Best regards,
Steven Huey

--
Steven Huey Software - http://www.stevenhuey.com




_______________________________________________

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: 
 >Custom NSPredicateEditorRowTemplate with Single Item (From: Steven Huey <email@hidden>)
 >Re: Custom NSPredicateEditorRowTemplate with Single Item (From: Peter Ammon <email@hidden>)

  • Prev by Date: Re: NSApp with wrong _running count
  • Next by Date: NSTableView and NSImageView issues
  • Previous by thread: Re: Custom NSPredicateEditorRowTemplate with Single Item
  • Next by thread: Re: XML schema support (Stuart Malin)
  • Index(es):
    • Date
    • Thread