0

I am working on display PDF from resourse folder on UIScrollview. But it is not able to add.

I add UIScrollView on ViewController. Then take a UIImageView and add on UIScrollView as bellow code.

scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0.0, 0.0,768,1024)];
scrollView.contentSize = CGSizeMake(768,2000);
scrollView.delegate = self;
scrollView.pagingEnabled = NO;
[self.view addSubview:scrollView];

UIImageView  *img=[[UIImageView alloc] initWithFrame:CGRectMake(00, 20, 500,900)];
NSString *url = [[NSBundle mainBundle]pathForResource:@"Acknowledgements" ofType:@"pdf"];
img.image=[UIImage imageWithContentsOfFile:url];        
[scrollView addSubview:img]; 

But pdf is not added on scrollview. If i add some image file like

 NSString *url = [[NSBundle mainBundle]pathForResource:@"trophy" ofType:@"png"];

It get added. PDF file is correct and open in Mac. Same case happen with PPT file.

what is going wrong. Thanks

2

2 Answers 2

0

@interface UIWebView : UIView < NSCoding, UIScrollViewDelegate > {

UIWebView implements UIScrollViewDelegate. So you can still handle your scroll related events. Check this link for delegate methods of UIScrollView http://developer.apple.com/library/ios/#documentation/uikit/reference/uiscrollviewdelegate_protocol/Reference/UIScrollViewDelegate.html

0

ppt/pdf cant be added to UIImageView, rather than add it in UIWebView

NSString *url = [[NSBundle mainBundle]pathForResource:@"Acknowledgements" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:url];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
1
  • thanks .it work on webview.but i want to display on scrollview, so that i can access userinteraction like slide pdf on scrollview,ended reading pdf on scrollview.what replacment for scrollview should i have to use ? Mar 26, 2013 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.