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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:12:29+00:00 2026-06-02T10:12:29+00:00

I have a MainWindow class that is built from a nib and set up

  • 0

I have a MainWindow class that is built from a nib and set up as follows:

- (void)applicationDidFinishLaunching:(UIApplication *)application
{
    MainViewController *mainView = [[MainViewController alloc] initWithNibName:@"MainViewController"
                                                                        bundle:nil];
    if(!mainView)
    {
        return;
    }
    naviController = [[UINavigationController alloc] initWithRootViewController:mainView];
    [naviController setToolbarHidden:YES];
    [[naviController navigationBar] setTintColor:[UIColor blackColor]];
    [[naviController toolbar] setTintColor:[UIColor blackColor]];
    [self.window setRootViewController:naviController];
    [self.window makeKeyAndVisible];
}

This works and correctly displays the MainViewController, but when I try to scroll down in the MainViewController‘s table view it throws an EXC_BAD_ACCESS. Apparently UIKit is referring to a second MainViewController that was built in [self.window makeKeyAndVisible]; I can’t figure out why it is referencing that over the one I passed into initWithRootViewController:mainView.

Here are the two MainViewControllers. The first one I initialize, the second is created in makeKeyAndVisible.

enter image description here

Here is the second MainViewController being called as a zombie.

enter image description here

Any ideas on why this is happening?

As requested:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    MainViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MainViewCell"];
    int i = [indexPath row];
    NSLog(@"%d\n",i);
    if (cell == nil) {
        // Create a temporary UIViewController to instantiate the custom cell.
        UIViewController *temporaryController = [[UIViewController alloc] initWithNibName:@"MainViewCell" bundle:nil];
        // Grab a pointer to the custom cell.
        cell = (MainViewCell *)temporaryController.view;
        // Release the temporary UIViewController.
        [temporaryController release];
    }
    [[cell icon] setImage:[UIImage imageNamed:[[moduleXMLList objectAtIndex:i] objectForKey:@"thumbnail"]]];
    [[cell title] setText:[[moduleXMLList objectAtIndex:i] objectForKey:@"title"]];
    [[cell description] setText:[[moduleXMLList objectAtIndex:i] objectForKey:@"description"]];
    return cell;
}
  • 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-02T10:12:42+00:00Added an answer on June 2, 2026 at 10:12 am

    The problem was that I was using File’s Owner as a MainViewController while having a second UIViewController under Objects. This is wrong, and so once I got rid of the Object and just used File’s Owner it worked like a charm.

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

Sidebar

Related Questions

I have a WPF application with the main Window class called MainWindow. Since I
This is the problem, I have a class MainWindow that extends JFrame in one
I have a class that inherits QMainWindow and I just want it to have
I have a view that is loaded in the MainWindow.xib. It is just a
I have the following code: <Window x:Class=kkk.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525> <Window.Resources> <Style
i have a window which is like this <Window x:Class=pharmacy_Concept.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350
Guys, I have a basic WPF application. Contains App.xaml as always and a Mainwindow.xaml.
I have a custom class that I would like to bind a WPF TreeView
I have got a StartCommand Class: public class StartCommand : ICommand { public void
I have a Class Person that consists of FirstName and LastName. I created an

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.