一个navigation controller的根视图控制器是一个table view controller,然后会根据对table view row的点击,推入一个web view,这个web view由一个web view controller管理。
问题是:每次点击row切换至web view会有残影出现,而且显示出的web view上面好像蒙了一层纱,很模糊。附上演示动画和Interface Builder 里为web view congroller创建的xib文件截图。
需要说明的是,在没有加入web view controller之前,没有残影出现,一切正常。


以下是web view controller的代码:
RAPWebViewController.h
#import <UIKit/UIKit.h>
@interface RAPWebViewController : UIViewController
@property (nonatomic) NSURL *URL;
@end
RAPWebViewController.m
#import "RAPWebViewController.h"
@interface RAPWebViewController ()
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@end
@implementation RAPWebViewController
- (IBAction)goBackward:(id)sender {
    [self.webView goBack];
}
- (IBAction)goForward:(id)sender {
    [self.webView goForward];
}
- (void)setURL:(NSURL *)URL
{
    _URL = URL;
    if (_URL) {
        NSURLRequest *req = [NSURLRequest requestWithURL:_URL];
        [self.webView loadRequest:req];
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
                            
                                    Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
自己发现原因了,我又傻逼了,不小心把容器视图的
alpha值设为0.5了,虽然我记忆中没有动过它,但是将它改为1之后没有残影和模糊效果了。值得注意的是,原来如果alpha值不为1,竟然会有残影效果,哈哈。