2

i have a webviewcontroller in which i am loading a saved html page or a pdf or any other document by this code.

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"yahoo" ofType:@"html"]isDirectory:YES]]];

i an trying to load a document and show it using horizontal scroll not vertical scroll.

can someone help me how to do this.

Thanks

Kshitiz Ghimire
  • 1,716
  • 3
  • 18
  • 37
Rishi
  • 3,499
  • 8
  • 35
  • 54

3 Answers3

0

Add this in your page -

<link media="only screen and (max-width: 1000px)"
  rel="stylesheet" type="text/css" href="iphone.css"/>

You can increase the page width to suite your needs

Saurabh
  • 22,743
  • 12
  • 84
  • 133
  • thanks saurabh for your reply but if i have to load a pdf by programmatically showing page by page how would i scroll through them horizontally. – Rishi Apr 05 '11 at 05:30
  • Please edit your question for this...right now your question is not describing your problem exactly! – Saurabh Apr 05 '11 at 05:34
0

first you create the view horizontally and then you load that document to this view..then you can able to scroll horizontally....

UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];  
scroll.pagingEnabled = YES;  
NSInteger numberOfViews = 3;  
for (int i = 0; i < numberOfViews; i++) {  
CGFloat yOrigin = i * self.view.frame.size.width;  
UIView *awesomeView = [[UIView alloc] initWithFrame:CGRectMake(yOrigin, 0,   self.view.frame.size.width, self.view.frame.size.height)];  
awesomeView.backgroundColor = [UIColor colorWithRed:0.5/i green:0.5 blue:0.5 alpha:1];  
[scroll addSubview:awesomeView];  
[awesomeView release];
}
scroll.contentSize = CGSizeMake(self.view.frame.size.width * numberOfViews,   self.view.frame.size.height);  
[self.view addSubview:scroll];  

[for more details][1]


  [1]: http://idevzilla.com/2010/09/16/uiscrollview-a-really-simple-tutorial/
Saurabh Prajapati
  • 2,348
  • 1
  • 24
  • 42
Aravindhan
  • 15,608
  • 10
  • 56
  • 71
0

You can use the following code, as it worked fine for me:

[self.tableView scrollToRowAtIndexPath:someIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]
eeerahul
  • 1,629
  • 4
  • 27
  • 38