如何解决模拟器中出现黑屏问题
| 我正在为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。有人可以帮忙吗?
解决方法
在[YourApp] -info.plist的\“ Supporting Files \”文件夹中检查\“主笔尖文件库名称\”的设置–如果您更改了根视图控制器的名称,则可能需要在这里也更改名称。
,出于某种奇怪的原因,我的App Delegate的引用插座已断开连接。
尝试使用App Delegate的连接检查器(最右边的菜单)创建从代理人到File \'s Owner的引用出口。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。