Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue with contentOffset
    primarykey
    data
    text
    <p>Right now i'm working on an app which uses a custom splitView, it has a <code>PDFTableController</code> which represents the rootViewController and popover table and I have <code>AffirmaPDFViewController</code> which represents the detailViewController.</p> <p>The way the interface is set up is that there is a scrollView and within the scrollView there are three WebViews which load up PDFs to be viewed. These WebViews have a width of 1024px and placed side by side to allow swiping.</p> <p>When I select an item from the table I return both the item selected and the row number, because I need to change the origin of the scrollView by a multiplier which is represented the row number. my code is as seen below:</p> <pre><code>start = ((i) * 1024); NSLog(@"%d", start); scrollView.contentOffset = CGPointMake(webView1.frame.origin.x + start, webView1.frame.origin.y); </code></pre> <p><code>i</code> is the row number which is provided by the <code>PDFTableController</code>. The <code>start</code> variable comes out with the appropriate value, (0, 1024, 2048, etc) and the scrollView moves. However it does not change which webView is being shown. Anyone know why this is?</p> <p>To set up the webViews I used IB, however I change some properties when rotation occurs:</p> <pre><code>- (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]; } </code></pre> <p>The [<code>________ reload];</code> calls are there because of an issue with webViews loading PDF's and rotation, a bit of a stretch I know, but this is the only fix I've been able to find</p> <p>I'm loading the content to the webViews by:</p> <pre><code>- (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]]; } </code></pre> <p>2011-05-31 10:38:16.465 AffirmaPDF[1927:207] {{1.17666e-40, 3.4481e-36}, {1.35492e-41, -1.99922}}</p> <p>2011-05-31 10:38:16.467 AffirmaPDF[1927:207] {{2.98701e-41, 1.35492e-41}, {0, -1.99921}}</p> <p>2011-05-31 10:38:16.468 AffirmaPDF[1927:207] {{2.19627e-37, 3.4481e-36}, {3.48195e-41, 3.4481e-36}}</p> <p>2011-05-31 10:38:16.469 AffirmaPDF[1927:207] {{2.19615e-37, 2.55515e-39}, {2.19615e-37, -1.99921}}</p> <p>2011-05-31 10:38:16.470 AffirmaPDF[1927:207] {0, 0}</p> <p>2011-05-31 10:38:16.470 AffirmaPDF[1927:207] {0, 0}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload