gpt4 book ai didi

ios - 屏幕下方出现不需要的白条

转载 作者:行者123 更新时间:2023-11-29 03:59:47 27 4
gpt4 key购买 nike

我有两个 View Controller ,vc1 和 vc2。从 vc1 转到 vc2,在 vc2 内我使用 Web View 播放 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];
}

请参阅下面白色条所附的屏幕截图。

screenshot

最佳答案

尝试使用 Root View Controller 初始化导航 Controller 。

navigationController = [[UINavigationController alloc] initWithRootViewController:vc1];

关于ios - 屏幕下方出现不需要的白条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16027015/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com