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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:38:38+00:00 2026-05-22T14:38:38+00:00

In my main nib (nib1), I have a button that activates another nib (nib2)

  • 0

In my main nib (nib1), I have a button that activates another nib (nib2) using the piece of code below.

The way that I currently pass values to nib2 and obtain from nib2 is by creating class methods in nib1. But one of my goal of this exercise project is that I need to design nib2 such that I will be able to re-use nib2 at another later project. That implies nib2 should not know anything about nib1’s class. So that when I re-use nib2 at a later time, I do not need to modify its code (to call nib1’class methods.)

I was thinking about creating class methods in nib2’s class. But then how will I be able to call the method before nib2 is active?

Is my approach right? any comments?

NSWindowController *iQWController = [[NSWindowController alloc] initWithWindowNibName:@"iQueryWindow"];
[iQWController showWindow:sender];
  • 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-05-22T14:38:38+00:00Added an answer on May 22, 2026 at 2:38 pm

    For this example I assume you have class definitions nib1.h/nib1.m/nib1.xib & nib2.h/nib2.m/nib2.xib

    You should create properties in nib2 for getting the data into nib 2.

    To get data from nib 2 back to nib 1, you should define a delegate protocol, have nib 1 implement it and set it as nib 2’s delegate.

    nib2.h would look something like:

    @protocol Nib2Delegate;
    
    @interface Nib2 : UIViewController {
        id <Nib2Delegate> delegate;
    }
    
    @property (nonatomic, assign) id <Nib2Delegate> delegate;
    
    @end
    
    @protocol Nib2Delegate 
    
    - (void)myMethod;
    
    @end
    

    in Nib1.h you would have:

    #import "Nib2.h"
    
    @interface Nib1 : UITableViewController <Nib1Delegate> {
    
    }
    
    - (void)myMethod;
    
    @end
    

    in Nib1.m

    Nib2 *nib2 = [[Nib2 alloc] initWithNibName:@"Nib2" bundle:nil];
    nib2.delegate = self;
    

    Then you would implement myMethod in Nib1.m. When you want to call it in Nib2.m it would look like

    [delegate myMethod];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a second .nib file that is a localized version of the main
I have a nib file I'm trying to instantiate in code. My UIViewController's main
I have subclassed UIView and created a NIB that controls the main logic for
I have a ViewController with a nib file and want to delegate code that
I currently have a simple iPhone app that loads a custom subclass of UIView.
Looking for some guidance. In my main window nib file, i have a tab
I have a one button on my main storyboard. I'm pretty sure it's linked
So i have my main viewController and all i have is a single button
I have created a main View and in that I add 9 UIMyView that
Editing my nib for a document-based Cocoa application, I see that when I have

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.