现在我正在开发一个使用自定义splitView的应用程序,它有一个PDFTableController
代表rootViewController和popover表,我有AffirmaPDFViewController
代表detailViewController。
界面的设置方式是有一个scrollView,在scrollView中有三个WebView可以加载要查看的PDF。这些WebView的宽度为1024像素,并排放置以允许滑动。
当我从表中选择一个项目时,我返回所选项目和行号,因为我需要用乘数来改变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的webViews,但是我在轮换发生时更改了一些属性:
- (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];
来电是因为webView加载PDF和旋转的问题,我知道这一点,但这是我能够解决的唯一问题。发现
我将内容加载到webViews:
- (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}
答案 0 :(得分:0)
根据垃圾值,看起来滚动视图和Web视图尚未添加到视图层次结构中,或者它们尚未通过插件连接。