• 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: Customizing UIPageViewController during init
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Customizing UIPageViewController during init


  • Subject: Re: Customizing UIPageViewController during init
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 24 May 2017 10:22:02 -0700

On May 24, 2017, at 08:17 , Steve Mills <email@hidden> 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 (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: 
 >Customizing UIPageViewController during init (From: Steve Mills <email@hidden>)

  • Prev by Date: Re: Auto Layout Question
  • Next by Date: Re: number formatter
  • Previous by thread: Customizing UIPageViewController during init
  • Next by thread: number formatter
  • Index(es):
    • Date
    • Thread