Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My task is to allow scrolling the landscape. The design is for portait. I came up with an idea to add a ScrollView to components, or in "Embed in Scroll View" in <a href="http://en.wikipedia.org/wiki/Interface_Builder" rel="nofollow noreferrer">Interface Builder</a>. I have expected it will work, but no. I am using <a href="http://en.wikipedia.org/wiki/Xcode" rel="nofollow noreferrer">Xcode</a> 4.4, iOS 5.1, (office project need support for 4.2 too), but the problem is the same.</p> <p>In Stack Overflow question <em><a href="https://stackoverflow.com/questions/3409756/iphone-sdk-uiscrollview-does-not-scroll">iPhone SDK: UIScrollView does not scroll</a></em> there is one row which solve a problem.</p> <p>Other try is in Stack Overflow question <em><a href="https://stackoverflow.com/questions/9702471/ios-uiscrollview-not-working-doesnt-scroll-at-all-image-stays-fixed">iOS - UIScrollView is not working (it doesn't scroll at all - the image stays fixed)</a></em>, and this helped me, combined with other, so here is my portait-to-scrollable landscape code:</p> <pre><code>- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromOrientation { if( UIInterfaceOrientationIsPortrait( [[UIApplication sharedApplication] statusBarOrientation] ) ){ scrollView.contentSize = portaitScrollSize; } else{//statusbar is Landscape scrollView.contentSize = landscapeScrollSize; } } </code></pre> <p>The scrollView in bound to an iVar view in Interface Builder. <code>portaitScrollSize</code> and <code>landscapeScrollSize</code> are private variables. They are initialized and doesn't change. In <code>my.h</code> file:</p> <pre><code>IBOutlet UIScrollView *scrollView; </code></pre> <p>In <code>my.m</code> file:</p> <pre><code>CGSize portaitScrollSize, landscapeScrollSize; </code></pre> <p>...</p> <pre><code>portaitScrollSize = CGSizeMake(320,440); landscapeScrollSize = CGSizeMake(480,480); </code></pre> <p>I hope it will help somebody to add a rotating + scroll feature to a portait design.</p> <p>Don't forget to allow portait+landscape on the <strong>top component</strong>:</p> <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return TRUE; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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