我有两个视图控制器,vc1 和 vc2。我从 vc1 转到 vc2,在 vc2 内我使用网络视图播放 youtube 视频。当我回到 vc1 时,我的屏幕下方出现一个白条。这是我的代码。
/* From App Delegate to go vc1 */
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
VC1 *vc1 = [[VC1 alloc] init];
navigationController = [[UINavigationController alloc] init];
[navigationController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[navigationController setToolbarHidden:YES];
[navigationController setNavigationBarHidden:YES];
[navigationController setWantsFullScreenLayout:YES];
[navigationController pushViewController:vc1 animated:FALSE];
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
return YES;
}
/* From VC1 to VC2 */
-(IBAction)gotoVC2:(id)sender
{
VC2 *vc2 = [[VC2 alloc] init];
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.navigationController vc2 animated:YES];
}
/* Setting up YouTube View */
-(void) addYouTubeLink:(UIWebView*)webView url:(NSString*)url
{
for (UIView* shadowView in [webView.scrollView subviews])
{
if ([shadowView isKindOfClass:[UIImageView class]]) {
[shadowView setHidden:YES];
}
}
NSString *videoHTML = [NSString stringWithFormat:@"<html><head></head><body><iframe class=\"youtube-player\" type=\"text/html\" width=\"420\" height=\"315\" src=\"http://www.youtube.com/embed/%@\" align=\"middle\" frameborder=\"1\"></iframe></body></html>",url];
[webView loadHTMLString:videoHTML baseURL:nil];
}
/* Going Back to VC1 */
- (IBAction)goBack:(id)sender {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.navigationController setNavigationBarHidden:YES];
[appDelegate.navigationController setWantsFullScreenLayout:YES];
[appDelegate.navigationController popViewControllerAnimated:YES];
}
请参阅下面白条的截图。