• 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
Incorrect instance of custom view loading after unarchiving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Incorrect instance of custom view loading after unarchiving


  • Subject: Incorrect instance of custom view loading after unarchiving
  • From: Sam Krishna <email@hidden>
  • Date: Fri, 22 Aug 2008 23:45:49 -0400

Hi all,

OK, I've read all the email from the past month about Aaron's challenge in Ch. 18 of Cocoa Programming. I've got a custom view (OvalView) where the magic happens. I've got Undo working, but I can't get the app to load a saved document b/c it keeps loading the wrong instance of OvalView on unarchiving.

Here's a log output describing what I'm talking about:

--------
[Session started at 2008-08-22 22:40:12 -0400.]
2008-08-22 22:40:17.712 OvalFun[55611:10b] In -initWithCoder
2008-08-22 22:40:17.713 OvalFun[55611:10b] self = <MyDocument: 0x16b7a030>
2008-08-22 22:40:17.714 OvalFun[55611:10b] ovalView = <OvalView: 0x16b78c00>
2008-08-22 22:40:17.716 OvalFun[55611:10b] In -initWithFrame
2008-08-22 22:40:17.717 OvalFun[55611:10b] self = <OvalView: 0x16b7b920>
2008-08-22 22:40:17.718 OvalFun[55611:10b] In - windowControllerDidLoadNib
2008-08-22 22:40:17.718 OvalFun[55611:10b] self = <MyDocument: 0x16b794d0>
2008-08-22 22:40:17.718 OvalFun[55611:10b] ovalView = <OvalView: 0x16b7b920>
2008-08-22 22:40:17.719 OvalFun[55611:10b] About to set MyDocument's path!
2008-08-22 22:40:17.730 OvalFun[55611:10b] In -drawRect:
2008-08-22 22:40:17.731 OvalFun[55611:10b] Number of objects in [doc ovals]: 0


--------------------

After I enter MyDocument's -windowControllerDidLoadNib method, it *looks* as if my OvalView object is completely different from the OvalView object I unarchived in -initWithCoder.

Here's my Q: What do I need to do to fix it? Is there some simple IB3 gestalt that I'm missing? Some NSCoding voodoo that's completely obvious? what gives?

TIA!

Live Playfully,

Sam

_______________________________________________

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: Incorrect instance of custom view loading after unarchiving
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: ObjC 2.0, properties, KVC, special _ hacks etc.
  • Next by Date: Re: !foo vs foo == nil
  • Previous by thread: Re: Custom view instantiated twice?
  • Next by thread: Re: Incorrect instance of custom view loading after unarchiving
  • Index(es):
    • Date
    • Thread