Note that there are some explanatory texts on larger screens.

plurals
  1. POIronically Pushing Blank View Controllers
    text
    copied!<p>this is my first post on here, though with the help of many questions and answers from members of this community, I have brought my project to near completion.</p> <p>I have read multiple threads similar to what I'm asking, but the methods were completely different. No code has worked so far.</p> <p>Basically (I say this because my code involves a lovely snake-like descent into a complicated mess, but applicable snippets will be put up upon request), my problem is that I'm calling</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath </code></pre> <p>and it pushes my viewcontroller in the simulator and NSLogs the string I need changed beautifully, but it pushes a blank view! The code for that run makes the view controller variable a constant:</p> <pre><code>UIViewController *viewController = [[xSheetMusicViewController alloc]initWithNibName:nil bundle:nil]; </code></pre> <p>So I thought to myself, what am I doing!? So I went back to the old method, which involved making the UIViewcontroller an if-then, if-else-then statement that would push different views depending on whether certain rows were selected (standard stuff). Which pushed a new view with my string loaded perfectly, but it only NSLog'ed one string over and over! And the worst part was the my app would call either SIGABRT, or EXC_BAD_ACCESS when I tried returning to the rootviewcontroller. (here's the applicable code):</p> <pre><code>UIViewController *viewController = [[[UIViewController alloc]init]autorelease]; if (indexPath.row == 0 &amp;&amp; indexPath.section == 0) { appDelegate.baseURL = @"mussette.pdf"; viewcontroller = [[xSheetmusicViewController alloc]initwithnibname:nil bundle:nil]; } else if (...) //pushview, changestring, blah blah// </code></pre> <p>Now, I would prefer that my view push the PDF like it's supposed to, and have the correct string value (and not give me SIGABRT or EXC_BAD_ACESS, but those are givens), but it seems that compromise is just out of my reach. I know there's probably something stupid I'm doing that could be solved with one line of code, but for now, it seems hopeless.</p> <p>Thanks in advance. </p> <p>EDIT: To answer all of your questions, yes, there is no xib, rather an (id)init method in the next view. </p> <p>EDIT 2: to answer lostInTransit's request and add some additional details:</p> <pre><code>&lt;else if (indexPath.row == 1 &amp;&amp; indexPath.section == 0) { appDelegate.baseURL = @"Importing PDF's.pdf"; </code></pre> <p>Also, if it helps, the output keeps logging: Application tried to push a nil view controller on target .</p> <p>When I try to push the view from a tableviewcell, and it did that before when it loaded the PDF right so I ignored it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload