模拟器中出现黑屏问题
|
我正在为iPad开发游戏,并且通过菜单屏幕启动它。有一阵子,菜单屏幕会在模拟器中显示出来。我正在使用xcode在启动基于视图的应用程序时提供的主视图控制器。但是,不幸的是,我不小心切断了UIView和界面生成器中的视图控制器之间的连接,并且在重新连接后,屏幕现在变成空白。当我在界面生成器中模拟屏幕时,它可以正常工作,但在xcode中运行时却不能。这是视图控制器的代码:
//
// 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
我在这里没有真正看到任何问题,因此我假设这与将视图控制器重新连接到视图有关。我没有正在使用的实际视图文件,只有viewcontroller。有人可以帮忙吗?
没有找到相关结果
已邀请:
2 个回复
贸会
扑北爱