我有被添加到各个分镜图上负载UIWebView
类每次返回相同的页面,但路过的时候进入这个类的页面我需要形成父ViewController
只显示来自文件有史以来第一页和每个不同的页面/ viewController它是相同的,即使我把它设置为每个不同。iOS版:的NSURLRequest不同的故事板
难道是以某种方式缓存这个页面,如果是这样,我怎么能每次都有一个干净的UIWebview
?
我UIWebView的M级文件(ContentView.m):
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
NSString *urlpath = [[NSBundle mainBundle] pathForResource:pageToDisplay ofType:@"html" inDirectory:@"pageContent"];
NSURL *url=[[NSURL alloc] initFileURLWithPath:urlpath];
NSURLRequest *request=[NSURLRequest requestWithURL:url];
[self loadRequest:request];
}
return self;
}
我父视图使用通过被请求的页面下面的变量pageToDisplay
:
父视图M档:
#import "ContentView.h"
- (void)viewDidLoad {
ContentView *dispalyPageContent = [[ContentView alloc] init];
[dispalyPageContent setPageToDisplay:@"THEpg1"];
[self.view addSubview:dispalyPageContent];
//--
[super viewDidLoad];
}
对于每个其他父视图代码是相同的,但应该改变我想要的页面的[displayPageContent setPageToDisplay:@"THEpg1"];
,例如下一个视图将是[displayPageContent setPageToDisplay:@“THEpg2”];
是否可以清除它并每次加载新的请求?
感谢您的回复,但我得到这个错误: '内容查看' 无可见@interface声明选择器'pageToDisp:使用以下ContentView * dispalyPageContent = [[ContentView alloc] initWithFrame:CGRectMake(10,60,300,300)pageToDisp:@“THEpg1”];谢谢 –
道歉看看代码我可能错过了initwithframe方法结尾处的额外变量,当我重新进入并让你知道谢谢 –
非常感谢。 –