我对此很陌生,我正在制作我的第一个应用程序。当我尝试运行它时,xcode 说它成功了,但是模拟器只是给了我一个黑屏,我收到了这个消息。这是我的 main.m 代码:
@implementation ViewController
@synthesize button;
@synthesize text;
- (IBAction)pushButton:(id)sender
{
CGRect webRect=CGRectMake(10, 10, 2048, 1536);
UIWebView *myWebview = [[UIWebView alloc] initWithFrame:webRect];
myWebview.scalesPageToFit = YES;
NSURL *url = [NSURL URLWithString:@"http://www.coronetjck/schedule"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[myWebview loadRequest:request];
[self.view addSubview:myWebview];
}
//web view after pushing button
-(void)loadView {
NSString *moviePath = [[[NSBundle mainBundle] resourcePath]
stringByAppendingPathComponent:@"the_people_vs._george_lucas_teaser_hd_teaser_2_640x360.mp4"];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];
moviePlayer.movieControlMode = MPMovieControlModeDefault;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[moviePlayer play];
}
//video
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[self setButton:nil];
[self setText:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
@end
我不确定我做错了什么,有人可以帮助我吗?我将不胜感激。