UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake( 0, 0, 320, 480 )];
NSString *path = [[NSBundle mainBundle] pathForResource:@"about" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
webView.scalesPageToFit = YES;
[self.view addSubview:webView];
[webView release];
ИЛИ
- (void) viewWillAppear: (BOOL)animated {
[super viewWillAppear:animated];
UIWebView *tempWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height)];
tempWebView.backgroundColor = [UIColor whiteColor];
tempWebView.scalesPageToFit = YES;
tempWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
tempWebView.delegate = self;
[self.view addSubview:tempWebView];
[self setWebView:tempWebView];
[tempWebView release];
NSString *fileName = [pdfFile objectForKey:FILENAME_KEY];
NSString *urlAddress = [[NSBundle mainBundle] pathForResource:fileName ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
}