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 8263759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:12:51+00:00 2026-06-08T04:12:51+00:00

I am reasonably new to Xcode and Objective C. I have successfully loaded all

  • 0

I am reasonably new to Xcode and Objective C.

I have successfully loaded all of the GUI objects on one of my views dynamically..

Now i want to repeat the same dynamically loaded content onto all or most of my views..

I have a method in the main view like this:

-(void)loadinfo:(id)sender{
//All dynamically loaded content etc..
}

I currently have the main view calling this method like so.

[self loadinfo];

So now i need to know (without copying and pasting the method into all of my views) how to call the method from the main view into other views?

I hope this all makes sense.

Edit

I am more knowledgeable in PHP so if i was to do the same thing in php i would make a file called functions.php and include that file into all of the pages.. Is it the same concept?

  • 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-08T04:12:52+00:00Added an answer on June 8, 2026 at 4:12 am

    The concept is different from the approach you find with functions in PHP. In Objective C one works with objects. To share behavior (your PHP functions, called methods in Objective C) between objects you need to slot that behavior somewhere into your class hierarchy.

    So for your specific case you would implement the loadinfo method in a generic class which is a subclass of NSView, say MyGenericView. Both your view1 and view2 classes would then subclass from that generic class and inherit the loadinfo method.

    In case you want to divert from the implementation of loadinfo in your base class, you can override it partially by doing (in view1 or view2):

    - (void) loadview {
      [super loadview]; // perform the default implementation
      [self doSomethingDifferint]; // perform subclass specific stuff
    }
    

    … or:

    - (void) loadview {
      [self doSomethingDifferint]; // perform subclass specific stuff
      [super loadview]; // perform the default implementation
    }
    

    … or override completely by doing:

    - (void) loadview {
      [self doSomethingCompletelyDifferent]; // perform subclass specific stuff
    }
    

    Just on a side note: it’s good practice to follow CamelCase standards when naming your classes and methods in Objective C, so your classes would be View1 and View2 and the method would be loadInfo.

    Further, you might want to read up on generic OO principles and Objective C‘s specific aspects of it to take full advantage of the language and its features.

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

Sidebar

Related Questions

Hello all at StackOverflow.. Reasonably new to this site, but I have had nothing
By now all Mac App Store developers know that all apps must have the
I am reasonably new to the inner workings of Python. I have been trying
Reasonably new to MVC. My problem is that I have a controller that has
I am reasonably new to Wordpress custom themes but I do have some knowlege
I am still reasonably new to this and have tried to find an answer,
I am reasonably new to C++ and have limited experience of templates. At the
To the esteemed readers. I'm reasonably new in javascript and I have come across
I'm reasonably new to Java EE, so this might be stupid.. bear with me
I'm reasonably new to using SQL, so I apologise if this is a newbish

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.