Iphone 在屏幕外设置UInavigationBar动画会留下黑色矩形

Iphone 在屏幕外设置UInavigationBar动画会留下黑色矩形,iphone,ios,uiwebview,uinavigationcontroller,uinavigationbar,Iphone,Ios,Uiwebview,Uinavigationcontroller,Uinavigationbar,我想在模式UIView出现时将UINavigationBar显示在屏幕上,就像在Reeder中一样 我正在使用优秀的SVWebViewController(https://github.com/samvermette/SVWebViewController)处理从shouldStartLoadWithRequest创建web浏览器的步骤 动画代码来自 导航栏中的所有内容都被放置在屏幕外,但留下的空间(我想在其中设置动画)是黑色的。视图/网络视图的其余部分为白色 如何将分配给导航栏的空间设置为白色

我想在模式UIView出现时将UINavigationBar显示在屏幕上,就像在Reeder中一样

我正在使用优秀的SVWebViewController(https://github.com/samvermette/SVWebViewController)处理从shouldStartLoadWithRequest创建web浏览器的步骤

动画代码来自

导航栏中的所有内容都被放置在屏幕外,但留下的空间(我想在其中设置动画)是黑色的。视图/网络视图的其余部分为白色

如何将分配给导航栏的空间设置为白色(即视图背景为白色)? 没有xib

我在SVWebViewController中找不到任何关于导航栏的内容(仅添加工具栏)

-(BOOL)webView:(UIWebView*)webView应与request一起加载:(NSURLRequest*)请求导航类型:(UIWebView导航类型)导航类型{
NSLog(@“他们点击:%@”,请求);
NSURL*requestURL=[请求URL];
if([[requestURL方案]IseQualtString:@“http”]| |[[requestURL方案]IseQualtString:@“https”])){
NSLog(@“Web链接%@”,requestURL);
SVModalWebViewController*webViewController=[[SVModalWebViewController alloc]initWithURL:requestURL];
webViewController.modalPresentationStyle=UIModalPresentationFullScreen;
webViewController.modalTransitionStyle=UIModalTransitionStyleCross溶解;
webViewController.availableActions=SVWebViewControllerAvailableActionsOpenSafari | SVWebViewControllerAvailableActionsPylink | SVWebViewControllerAvailableActionsMillink;
//损失5
if([[UINavigationBar类]响应选择器:@selector(外观)]){
//为导航背景创建图像-纵向
UIImage*NavigationGraphitalBackground=[[UIImage imageNamed:@“导航栏”\u bg\u肖像~iPad”]
带capinsets的可调整大小的图像:UIEdgeInsetsMake(0,0,0,0)];
//为导航背景创建图像-景观
UIImage*NavigationLandscapeBackground=[[UIImage ImageName:@“导航栏”\u bg\u肖像~iPad”]
带capinsets的可调整大小的图像:UIEdgeInsetsMake(0,0,0,0)];
//设置所有UINavigationBars的背景图像
[[UINavigationBar外观]setBackgroundImage:NavigationGraphicalBackgroundforBarMetrics:UIBarMetricsDefault];
[[UINavigationBar外观]setBackgroundImage:NavigationLandscapeBackground for BarMetrics:UIBarMetricsLandscapePhone];
[[UINavigationBar外观]setBackgroundColor:[UIColor whiteColor]];
//颜色影响按钮的颜色
UIColor*col=不透明的颜色(0xdb536a);
[[uibarbuttonite外观]setTintColor:col];
}否则{
//将导航栏设置为ios4
[webViewController.navigationBar ApplyCustomColor];
}
[self-presentModalViewController:webViewController动画:是];
//->此代码在动画之前隐藏UINavigationBar
CGRect navBarFrame=webViewController.navigationBar.frame;
navBarFrame.origin.y=-navBarFrame.size.height;
//设置杆的位置
webViewController.navigationBar.frame=navBarFrame;

//如果要将导航栏移到屏幕外,则此位置当前没有任何内容,这就是为什么它是黑色的。

您应该尝试放大网络视图,通过调整导航栏的“帧”属性来填充导航栏之前覆盖的空间。

如果您想将导航栏移到屏幕外,此位置当前没有任何内容,这就是为什么它是黑色的。

您应该尝试通过调整导航栏的frame属性来放大网络视图,以填充导航栏之前覆盖的空间。

在控制器和网络视图的nib文件中,设置网络视图上的自动调整大小掩码,以自动调整高度和宽度。然后它就会工作。

在控制器和网络视图的nib文件中,设置在Web视图上自动调整蒙版的大小,以自动调整高度和宽度。然后它就会工作。

若您为UINavigationBar设置动画,则更改留下区域的颜色的答案是


self.navigationController.view.backgroundColor=[UIColor redColor];

若对UINavigationBar设置动画,则更改留下区域的颜色的答案是


self.navigationController.view.backgroundColor=[UIColor redColor];

通过设置uiwebview掩码?如果是,请选择什么设置(我是xib粉丝!)我没有使用xib…以下是初始化代码-(void)loadView{mainWebView=[uiwebview alloc]initWithFrame:[UIScreen mainScreen].applicationFrame];[mainWebView setBackgroundColor:[UIColor greenColor]];mainWebView.delegate=self;mainWebView.scalesPageToFit=YES;[mainWebView加载请求:[NSURLRequest requestWithURL:self.URL]];self.view=mainWebView;}通过设置uiwebview掩码?如果是,请做些什么设置(我是锡伯族粉丝!)我没有使用xib…以下是初始化代码-(void)loadView{mainWebView=[[UIWebView alloc]initWithFrame:[UIScreen mainScreen].applicationFrame];[mainWebView setBackgroundColor:[UIColor greenColor]];mainWebView.delegate=self;mainWebView.ScalePage=YES;[mainWebView loadRequest:[nsurlRequestRequestWithURL:self.URL];self.view=mainWebView;}正如我提到的,该类没有xib,正如我提到的,该类没有xib
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSLog(@"They clicked: %@", request);

    NSURL *requestURL = [request URL];

    if ([[requestURL scheme ] isEqualToString: @"http"] || [[requestURL scheme] isEqualToString: @"https"]) {


            NSLog(@"Web link %@",requestURL);

            SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithURL:requestURL];
            webViewController.modalPresentationStyle = UIModalPresentationFullScreen;
            webViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

            webViewController.availableActions = SVWebViewControllerAvailableActionsOpenInSafari | SVWebViewControllerAvailableActionsCopyLink | SVWebViewControllerAvailableActionsMailLink;

            // ios5

            if ([[UINavigationBar class]respondsToSelector:@selector(appearance)]) {

                // Create image for navigation background - portrait
                UIImage *NavigationPortraitBackground = [[UIImage imageNamed:@"navbar_bg_portrait~iPad"]
                                                         resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

                // Create image for navigation background - landscape
                UIImage *NavigationLandscapeBackground = [[UIImage imageNamed:@"navbar_bg_portrait~iPad"]
                                                          resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];

                // Set the background image all UINavigationBars
                [[UINavigationBar appearance] setBackgroundImage:NavigationPortraitBackground forBarMetrics:UIBarMetricsDefault];
                [[UINavigationBar appearance] setBackgroundImage:NavigationLandscapeBackground forBarMetrics:UIBarMetricsLandscapePhone];

                [[UINavigationBar appearance] setBackgroundColor:[UIColor whiteColor]];

                // The tintcolor affects the button colour
                UIColor* col = OPAQUE_HEXCOLOR(0xdb536a);
                [[UIBarButtonItem appearance] setTintColor:col];

            } else {

                // Style the Nav Bar ios4
                [webViewController.navigationBar applyCustomTintColor];

            }
            [self presentModalViewController:webViewController animated:YES];


            // -> This code hides the UINavigationBar before animation

            CGRect navBarFrame = webViewController.navigationBar.frame;

            navBarFrame.origin.y = -navBarFrame.size.height;

            // set the position of the bar
            webViewController.navigationBar.frame = navBarFrame;

            // <- end Hide code


            return NO;

        }

    return YES;
}