• 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: value transformer for structs?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: value transformer for structs?


  • Subject: Re: value transformer for structs?
  • From: "John C. Randolph" <email@hidden>
  • Date: Thu, 23 Mar 2006 11:38:06 -0800


On Mar 23, 2006, at 10:21 AM, Derrick Bass wrote:

On Mar 23, 2006, at 7:45 AM, Michael B Johnson wrote:

@implementation MYQTTimeRangeValueTransformer
+ (Class)transformedValueClass { return [NSString self]; }
+ (BOOL)allowsReverseTransformation { return NO; }
- (id)transformedValue:(id)value {
	QTTimeRange* r = (QTTimeRange*)value;
	return (value == nil) ? nil : QTStringFromTimeRange(*r);
}
@end

A QTTimeRange is not an object, so casting an id to a QTTimeRange* is bad. What you need to do instead is use an NSValue internally. To get the time range in and out, you can use valueWithQTTimeRange and QTTimeRangeValue. E.g.

Whoops! I didn't spot that..

-jcr


John C. Randolph <email@hidden> (408) 914-0013 Roaming Cocoa Engineer, Available for your projects at great Expense and Inconvenience.



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


References: 
 >value transformer for structs? (From: Michael B Johnson <email@hidden>)
 >Re: value transformer for structs? (From: "John C. Randolph" <email@hidden>)
 >Re: value transformer for structs? (From: Michael B Johnson <email@hidden>)
 >Re: value transformer for structs? (From: Derrick Bass <email@hidden>)

  • Prev by Date: Re: NSImages are killing my WindowServer
  • Next by Date: Re: Changing the sender of an <NSTextAttachmentCell>
  • Previous by thread: Re: value transformer for structs?
  • Next by thread: CoreData questions
  • Index(es):
    • Date
    • Thread