• 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: packed NSTextfield and NSFormatter in IB3 plugin...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: packed NSTextfield and NSFormatter in IB3 plugin...


  • Subject: Re: packed NSTextfield and NSFormatter in IB3 plugin...
  • From: "Michael Ash" <email@hidden>
  • Date: Thu, 7 Aug 2008 15:46:16 -0400

On Thu, Aug 7, 2008 at 2:54 PM, Cyril Kardassevitch <email@hidden> wrote:
> hi list,
>
> I've investigated further and try to reproduce the problem with a simpler
> configuration. So, instead of using my custom objects, I've tried to pack
> directly NSTextField and NSNumberFormatter into one object inherited from
> NSTextField. An NSNumberFormatter is generated and become the formatter for
> the object inherited from NSTextView (testIBView) during its initialization.
>
> Here is its implementation :
>
>
> //  testIBView.m
>
> #import "testIBView.h"
>
> @implementation testIBView
>
> -(id)initWithFrame:(NSRect)frame
> {
>  self = [super initWithFrame:frame];
>
>  if (self)
>    [self setFormatter:[[NSNumberFormatter alloc] init]];
>
>  return self;
> }
>
> - (id)initWithCoder:(NSCoder *)decoder
> {
>  self = [super initWithCoder:decoder];
>
>  if (self)
>    [self setFormatter:[[NSNumberFormatter alloc] initWithCoder:decoder]];
>
>  return self;
> }
>
> - (void)encodeWithCoder:(NSCoder *)encoder
> {
>  [super encodeWithCoder:encoder];
>  [[self formatter] encodeWithCoder:encoder];
> }
>
> @end

I don't know if this is the source of your problem, but you really
shouldn't be doing things this way. You should never, ever call
initWithCoder: and encodeWithCoder: directly (unless you're writing a
subclass of NSCoder). If you want to encode and decode sub-objects,
use encodeObject:forKey: and decodeObjectForKey:.

Mike
_______________________________________________

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

  • Follow-Ups:
    • Re: packed NSTextfield and NSFormatter in IB3 plugin...
      • From: Cyril Kardassevitch <email@hidden>
References: 
 >packed NSTextfield and NSFormatter in IB3 plugin... (From: Cyril Kardassevitch <email@hidden>)
 >Re: packed NSTextfield and NSFormatter in IB3 plugin... (From: Cyril Kardassevitch <email@hidden>)

  • Prev by Date: Re: NSOperationQueue Memory Leak
  • Next by Date: Re: Confusion over FSMoveObjectToTrashSync docs
  • Previous by thread: Re: packed NSTextfield and NSFormatter in IB3 plugin...
  • Next by thread: Re: packed NSTextfield and NSFormatter in IB3 plugin...
  • Index(es):
    • Date
    • Thread