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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:16:51+00:00 2026-06-17T17:16:51+00:00

I’m having a problem similar to this… Why am I seeing a black screen?

  • 0

I’m having a problem similar to this… Why am I seeing a black screen? Did I not alloc something?

Sorry for the beginner question but I’m not sure how to debug this. I’m seeing a blank (black) screen for one of my view controllers. When I set the view controller to “is initial view controller” in the inspector, it works as expected. However when I remove that (it shouldn’t be the initial VC, just did that to debug) and navigate to the view, I get a blank (black) screen.

There is a webview in the VC (referenceDetailWebView) and when I try to log that out on the viewDidLoad of the VC and I get (null). Again, when I set the VC to be “initial”, it logs out the referenceDetailWebView object as expected.

This is the implementation of the VC…

@implementation DetailViewController

@synthesize currentReference, referenceDetailWebView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSString *htmlFile      = [[NSBundle mainBundle] pathForResource:@"reference/accommodation" ofType:@"html"];
    NSString *htmlString    = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];

    [referenceDetailWebView loadHTMLString:htmlString baseURL:nil];

    // log for debugging
    NSLog(@"%@", [self referenceDetailWebView]);

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
     // Dispose of any resources that can be recreated.
}

@end

The only thing that I can think of is that I might be missing something in my segues. I’m handling them programmatically and it’s very possible that I’m overlooking something there…? My didSelectRowAtIndexPath looks like this…

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    Reference *currentItem = [references objectAtIndex:indexPath.row];
    NSString *mySegueID;

    if([currentItem hasSubReferences]){
        mySegueID = @"ShowSubTable";
    } else {
        mySegueID = @"ShowDetail";
    }

    [self performSegueWithIdentifier:mySegueID sender:nil];

}

And my performSegueWithIdentifier looks like this…

- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender{

    // the segue with identifier allows us to chose a segue programatically

    NSIndexPath *path   = [self.tableView indexPathForSelectedRow];
    Reference *item     = [references objectAtIndex:path.row];

    if([identifier isEqualToString:@"ShowSubTable"]){

        // looking for sub table

        ReferencesSubTableViewController *subTableVC = [[ReferencesSubTableViewController alloc] initWithNibName:nil bundle:nil];
        [subTableVC setCurrentReference:item];
        [self.navigationController pushViewController:subTableVC animated:YES];

    } else if ([identifier isEqualToString:@"ShowDetail"]){

        // looking for detail view

        DetailViewController *detailVC = [[DetailViewController alloc] initWithNibName:nil bundle:nil];
        [detailVC setCurrentReference:item];
        [self.navigationController pushViewController:detailVC animated:YES];

    }

}

The segues are working as expected with the exception of that detailViewController displaying a blank screen and giving me null for my referenceDetailWebView.

I’m stuck. Any advice or guidance is very much appreciated! Thanks in advance for the help!!


Edit: It looks like the segues are probably the cause. When I remove the multiple segues and related code, and add a simple segue from the table cell to the DetailViewController only, the detailVC and views load correctly. Not sure what I’m missing in the segues though…?

I’ve simplified the performSegueWithIdentifier to the following and I’m still getting the blank screen…

- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender{ 

    NSIndexPath *path   = [self.tableView indexPathForSelectedRow];
    Reference *item     = [references objectAtIndex:path.row];

    DetailViewController *detailVC = [[DetailViewController alloc] initWithNibName:nil bundle:nil];

    [detailVC setCurrentReference:item];
    [detailVC setTitle:[item title]];
    [self.navigationController pushViewController:detailVC animated:YES];

}
  • 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-17T17:16:52+00:00Added an answer on June 17, 2026 at 5:16 pm

    You’re getting a black screen because you’re instantiating your controller incorrectly. Also, you don’t push the view controller with pushViewController:animated:, that’s done for you when you call performSegueWithIdentifier:. If you have the segue setup in the storyboard, then you should be implementing prepareForSegue:sender:, not performSegueWithIdentifier:. Its code should look like this:

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    
        // the segue with identifier allows us to chose a segue programatically
    
        NSIndexPath *path   = [self.tableView indexPathForSelectedRow];
        Reference *item     = [references objectAtIndex:path.row];
    
        if([segue.identifier isEqualToString:@"ShowSubTable"]){
    
            // looking for sub table
    
            ReferencesSubTableViewController *subTableVC = (ReferencesSubTableViewController *)segue.destinationViewController; 
            [subTableVC setCurrentReference:item];
    
        } else if ([segue.identifier isEqualToString:@"ShowDetail"]){
    
            // looking for detail view
    
            DetailViewController *detailVC = (DetailViewController *)segue.destinationViewController;
            [detailVC setCurrentReference:item];
        }
    }
    

    You really need to read and understand Apple’s docs on view controllers and segues — you clearly have some fundamental misunderstanding of the way they work.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

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.