On May 24, 2017, at 08:17 , Steve Mills <sjmi...@mac.com> wrote:
> 
> Is it wrong to call two different init methods?

Yes, I think you have to regard it as wrong. Apart from hidden weird behavior, 
it risks memory management problems, because init methods generally (should) 
refer to instance variables, not properties, and init code will generally 
assume that all instance variables are nil or 0.

What you can theoretically do is allocate *another* instance of 
UIPageViewController, initialize with the other init method, and return that 
instance instead of the “self” you started with. However, it’s not obvious that 
you can do this during unarchiving, because the unarchiver may have already 
recorded the “self” pointer that was passed in. Maybe that’s OK, I don’t know.

Alternatively, you could use the delegate method “unarchiver:didDecodeObject:” 
to replace the unarchived object with another instance that you initialized 
yourself.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to