的第二輪我寫的是創建一個子視圖,並將其添加到上海華盈,做什麼它需要在子視圖做,當我做一個應用程序:重新初始化整個子視圖上應用
[self.view removeFromSuperview];
並按下按鈕再次轉到第二個視圖,活動將保留在最後一次處於子視圖中的狀態。也就是說,在子視圖中,它播放視頻,當我第二次回來時,視頻處於完成狀態。
任何人都可以請告訴我如何重新初始化整個事情,所以它再次從字面上做「viewDidLoad」?因爲在我看來,它不會「重新加載視圖」。
這就是我在主視圖中所做的。
-(IBAction) localize: (id) sender{
[self showSplash];
}
-(void) showSplash{
UIViewController *modalViewController = [[UIViewController alloc] init];
modalViewController.view = splash;
[self presentModalViewController:modalViewController animated:YES];
[self performSelector:@selector(hideSplash) withObject: nil afterDelay:2.5];
}
-(void) hideSplash{
[[self modalViewController] dismissModalViewControllerAnimated:NO];
[[self modalViewController] release];
[self.view addSubview:locatorView.view];
}
在「locatorViewController」 viewDidLoad中,我初始化了的MPMoviePlayerController,的確,增加其作爲主視圖的子視圖的子視圖。視頻播放完畢後,我有一個按鈕,允許用戶返回並重試 - 也許會顯示另一個視頻。但是MPMoviePlayerController仍然在第一個視頻上。
我已經添加了一些代碼和評論:) –
當我想第二次播放電影時,MPMoviePlayerController現在變黑。你知道我怎麼能解決這個問題嗎?我到處尋找,但沒有找到解決辦法。 –
完成。我只是通過刪除索引處的子視圖來手動刪除MPMovieController:無論索引是什麼。 –