I wanna to scroll(down) on a UIWebView(iPad Application), where I will display a local pdf file, programmatically. I have added a UIWebView with the interface builder and linked it.
@interface ViewController : UIViewController <UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@end
This is my code for getting the pdf file and scrolling. The webViewDidFinishLoad function gets called.
@synthesize webView = _webView;
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
self.webView.delegate = self;
[self.webView loadRequest:request];
}
#pragma mark - UIWebViewDelegate
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSLog(@"didLoad");
self.webView.scrollView.contentOffset = CGPointMake(0, 500);
}
I am using the iOS SDK 6.1, the iOS deployment target is also 6.1.
Heres the log:
2013-04-23 09:23:08.742 PDFViewer[3834:c07] DiskImageCache: Could not resolve the absolute path of the old directory.
2013-04-23 09:23:08.913 PDFViewer[3834:c07] didLoad
The UIWebView isn't scrolling. The pdf is still at the first page.