RaysonK
RaysonK

Reputation: 553

Blank Screen Issue in Simulator

I'm working on a game for the iPad, and I have it start up with a menu screen. For a while, the menu screen would come up just fine in the simulator. I'm using the main view controller that xcode provides when starting up a view-based application. But, unfortunately, I accidentally cut off the connection between the UIView and the view controller in interface builder, and after reconnecting it, the screen comes up as blank now. It works fine when I simulate the screen in interface builder, but not when running in xcode. Here's the code for the view controller:

//
//  FunctionMachineViewController.h
//  FunctionMachine
//
//  Created by Kameron Schadt on 5/24/11.
//  Copyright 2011 Willamette University. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface FunctionMachineViewController : UIViewController {

IBOutlet UITextField* equation;
IBOutlet UISlider* startLevel;
IBOutlet UITextView* startLevelNumber;

}

- (IBAction) startOnePlayer:(id)sender;
- (IBAction) startTwoPlayer:(id)sender startingEquation:(NSString*)equationUsed;
- (IBAction) sliderValueChanged:(UISlider*)sender;

@property(nonatomic, retain) IBOutlet UISlider* startLevel;
@property(nonatomic, retain) IBOutlet UITextField* equation;
@property(nonatomic, retain) IBOutlet UITextView* startLevelNumber;

@end


//
//  FunctionMachineViewController.m
//  FunctionMachine
//
//  Created by Kameron Schadt on 5/24/11.
//  Copyright 2011 Willamette University. All rights reserved.
//

#import "FunctionMachineViewController.h"
#import "GameViewController.h"

@implementation FunctionMachineViewController

@synthesize equation, startLevel, startLevelNumber;

- (IBAction)sliderValueChanged:(UISlider*)sender {
[startLevelNumber setText:[NSString stringWithFormat:@" %.1f", [sender value]]];
}

-(IBAction)startOnePlayer:(id)sender
{
GameViewController* GameView = [[GameViewController alloc] initWithNibName:nil bundle:nil];
[GameView isOnePlayer:YES];
[self presentModalViewController:GameView animated:YES];
}

-(IBAction)startTwoPlayer:(id)sender startingEquation:(NSString*)equationUsed
{
GameViewController* GameView = [[GameViewController alloc] initWithNibName:nil bundle:nil];
[GameView isOnePlayer:NO];
[self presentModalViewController:GameView animated:YES];
}

- (void)viewDidLoad {
[super viewDidLoad];
}


// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:    (UIInterfaceOrientation)interfaceOrientation {
return YES;
}

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}


- (void)dealloc {
[super dealloc];
}

@end

I didn't really see any problem here, so I'm assuming it has something to do with me reconnecting the view controller to the view. I don't have an actual view file that I'm using, just the viewcontroller. Can anybody help?

Upvotes: 2

Views: 6181

Answers (2)

Geodude
Geodude

Reputation: 1

For some odd reason my Referencing outlet for the App Delegate was disconnected.

Try creating a referencing outlet from delegate to File's Owner using the connections inspector (farthest right menu) for your App Delegate.

Upvotes: 0

Scott Forbes
Scott Forbes

Reputation: 7417

Check the setting of "Main nib file base name" in [YourApp]-info.plist, in the "Supporting Files" folder – if you've changed the name of your root view controller, you may need to change the name here as well.

Upvotes: 2

Related Questions