Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8720647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:05:12+00:00 2026-06-13T07:05:12+00:00

Which method(s) in UIViewController is called only once, when the view is first presented?

  • 0

Which method(s) in UIViewController is called only once, when the view is first presented?

The reason I’m asking is I need to call the addObserver method of NSNotificationCenter, and I only need to do it once And, I don’t need to call removeObserver when the view goes out of sight. (Actually, I do some light processing when a notification is received when the view is out of sight.)

What is the best practice – what method should I call?
Is it viewDidLoad method – can anyone confirm if this method is called only ONCE and never called when the view appears subsequently?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:05:13+00:00Added an answer on June 13, 2026 at 7:05 am

    If a view controller allocates its resources programmatically, create a custom initialization method that is specific to your view controller. This method should call the super class’s init method and then perform any class specific initialization.

    In general, do not write complex initialization methods. Instead, implement a simple initialization method and then provide properties for clients of your view controller to configure its behaviors.

    2 steps,

    • The view controller calls its loadView method

    • If the view controller is associated with a storyboard, it loads the
      views from the storyboard. If the view controller is not associated
      with a storyboard, an empty UIView object is created and assigned to
      the view property.

    The view controller calls its viewDidLoad method, which enables your subclass to perform any additional load-time tasks.

    this diagram can give you a better idea

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIViewController (call it NumberTwo) which I presented as a modal view
I have an UIViewController (called MainViewController ) which presents modally a semi-transparent view (
Which method it is called on 3.ToString()? System.Int16.ToString() System.Int32.ToString() System.Int64.ToString()
I have a UIButton which calls a method from another UIViewController , that method
I have a superclass of UIViewController - MasterViewController which declares a property called itemsViewController
Which method should I override to be guaranteed to always get the correct size
Which method is preferred for adding a row to a table? var tr =
Which method is very effective and simple to code to attain this functionality ?
Which method can be used to read one line at a time from a
Which method is preferred to just show 2 links vertically, one over another? in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.