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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:39:53+00:00 2026-05-18T11:39:53+00:00

I have an iphone app that uses table view as the interface. Each time

  • 0

I have an iphone app that uses table view as the interface. Each time that the user taps on one of the table cells, I want to show another window to the user. However the user interface of the window that I push into the navigation controller are extremely similar. Therefore I decided to make a “generic nib file” to be used across all the subclasses of the file owner of this generic nib file.

However what I’m confused (and what’s not working) is that I can’t seem to be able to customise this generic nib file. I have this code at the initialisation of the files:

In the .h file:

#import <UIKit/UIKit.h>
#import "primeViewController.h"

@interface subclass1 : primeViewController { //subclassing from a generic view controller that owns a generic nib file

}

In the .m file:

#import "subclass1.h"

@implementation subclass1

- (id) initWithLabelAndButton {
    if(self = [super initWithNibName:@"primeViewController" bundle:nil]) {
        self.label.text = @"Title of the first subclass";   

    }
    return self;
}

But then when I instantiate the class in the table view:

//somewhere in rootviewcontroller.m:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    switch (indexPath.row) {
        case 0:
        {
            checkPrime* checkPrimeViewController = [[checkPrime alloc] initWithLabelAndButton];
            [self.navigationController pushViewController:checkPrimeViewController animated:YES];
            [checkPrimeViewController release];
            break;
        }
        default:
            break;
    }
}

So can anyone tell me what I’m doing wrong? Or am I wrong assuming that xcode allow me to use nib file multiple time across its subclasses? I don’t see why I can’t do it, but I can’t figure out how…

  • 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-18T11:39:53+00:00Added an answer on May 18, 2026 at 11:39 am

    When nib file is loaded, it creates view controller of exactly the same class that is written in .xib (UIViewController, or PrimeViewController, whatever else). What actually is saved in your .nib file?
    You’ll succeed if you will store UIView and all the corresponding objects in xib, and will load only them by using [[NSBundle mainBundle] loadNibNamed:@”YourNibFile” owner:class1ViewController options:nil], while view in nib is connected to the corresponding File owner outlet.

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

Sidebar

Related Questions

I have an iPhone app that uses a UINavigationController, some table views, and iAd.
I want to have a setting in an iphone app that uses a toggle
I want to have a global array/variable in an iPhone app that uses storyboard.
I have an iPhone app that uses the json-framework . I moved some of
I have written an iPhone app that uses the iPhone's relative GPS location. I
I have what I would consider a small sized iPhone app that uses SQLite.
I have an app that uses the iPhone camera and puts an overlay over
I am working on an iphone app in IOS5 that user storyboards. I have
I currently have an iPhone app in the iTunes app store that uses a
I have an iphone app that uses Core Data to do storage. 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.