现在我正在使用自定义splitView的应用程序,它有一个PDFTableController
它代表rootViewController和popover表,我有AffirmaPDFViewController
代表detailViewController。问题与contentOffset
接口的设置方式是有一个scrollView,在scrollView中有三个WebView加载PDF文件来查看。这些WebViews的宽度为1024px,并排放置以允许滑动。
当我从表中选择一个项目时,我返回选择的项目和行号,因为我需要通过表示行号的乘数来更改scrollView的原点。我的代码如下所示:
start = ((i) * 1024);
NSLog(@"%d", start);
scrollView.contentOffset = CGPointMake(webView1.frame.origin.x + start, webView1.frame.origin.y);
i
是其由PDFTableController
提供的行号。变量start
出来了适当的值,(0,1024,2048等)和scrollView移动。但它不会更改显示哪个webView。任何人都知道这是为什么?
要建立我用IB的网页视图,但是我改变一些属性,当发生旋转时:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
if(fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
counter = 0;
webView1.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
webView2.frame = CGRectMake(768, 0, self.view.frame.size.width, self.view.frame.size.height);
webView3.frame = CGRectMake(1536, 0, self.view.frame.size.width, self.view.frame.size.height);
isLandscape = NO;
}
else {
counter = 0;
webView1.frame = CGRectMake(0, 0, 1024, 724);
webView2.frame = CGRectMake(1024, 0, 1024, 724);
webView3.frame = CGRectMake(2048, 0, 1024, 724);
isLandscape = YES;
}
[webView1 reload];
[webView2 reload];
[webView3 reload];
}
的[________ reload];
电话是那里,因为与网页视图加载PDF的和旋转,有点的一个问题舒展我知道,但是这是唯一的解决方法我已经能够找到
我被加载内容的网页视图:
- (void)viewDidLoad {
pdfURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"affirma" ofType:@"pdf"]];
[webView1 loadRequest:[NSURLRequest requestWithURL:pdfURL]];
pdfURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"recursion" ofType:@"pdf"]];
[webView2 loadRequest:[NSURLRequest requestWithURL:pdfURL]];
pdfURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"review" ofType:@"pdf"]];
[webView3 loadRequest:[NSURLRequest requestWithURL:pdfURL]];
}
2011-05-31 10:38:16.465 AffirmaPDF [1927:207] {{1.17666e-40,3.4481e-36},{1.35492e-41,-1.99922}}
2011-05-31 10 :38:16.467 AffirmaPDF [1927:207] {{2.98701e-41,1.35492e-41},{0,-1.99921}}
2011-05-31 10:38:16.468 AffirmaPDF [1927:207] {{2.19627e-37,3.4481e-36},{3.48195e-41,3.4481e-36}}
2011-05-31 10:38:16.469 AffirmaPDF [1927:207] {{2.19615e- 37,2.55515e-39},{2.19615e-37,-1.99921}}
2011-05-31 10:38:16.470 AffirmaPDF [1927:207] {0,0}
2011-05-31 10:38:16.470 AffirmaPDF [1927:207] {0,0}
你能展示你如何设置网页浏览? – 2011-05-31 16:38:33
我刚刚为webViews提供了代码,使用此代码,在正确旋转ipad时调整大小。 – Ctak 2011-05-31 16:43:01
该webViews是scrollView的所有子视图 – Ctak 2011-05-31 16:45:35