IPhone SDK: how to add scrolling to an application?

I am creating an application for the iPhone that includes buttons that enliven the image, I created another view in which the buttons are held, however, I would like to be able to scroll this or that button horizontally or vertically. I looked at adding a scroll and I even went for a tutorial, but I just can't figure out how to add it to my application. Any ideas? In the tutorial, I followed a guy adding a scroll view to MainWindow.xib, now my application is created and designed in viewcontroller.xib. Therefore, after I read the tutorial, when I press "build" and go, it loads this tip, and all you see is a white background and a scroll view. (also in this tutorial, he scrolled the image where I would like to scroll the long look of the buttons). I understand,that the novice of my question may be crazy, but I am new to programming. Here's another additional question, if someone helped me get this scroll view, where would you design the contents of the scroll view if the length is longer than the iphone screen? Because I understand that the space for designing with the built-in interface is the size of the iphone screen and the development of interfaces is longer than the iphone screen is not capable of. (of course, I know this is skillful, I just don't know how to do it). Any help would be appreciated.that the space for designing with the built-in interface is the iphone screen size and the development of interfaces is longer than the iphone screen is not capable of. (of course, I know this is skillful, I just don't know how to do it). Any help would be appreciated.that the space for designing with the built-in interface is the iphone screen size and the development of interfaces is longer than the iphone screen is not capable of. (of course, I know this is skillful, I just don't know how to do it). Any help would be appreciated.

+5
source share
2 answers

You can programmatically configure the settings for viewing content (scroll area):

[scrollView setContentSize:CGSizeMake(contentViewWidth, contentViewHeight)];

Then add view components to the scroll view using the coordinate system of the content view. Therefore, say that your scroll profile was 100x100 pixels, and you want the scroll view to be twice as wide:

[scrollView setContentSize:CGSizeMake(200.0f, 100.0f)];

Then you can add a button for each half scroll:

// First half of content view
button1.frame.origin.x = 10.0f;
button1.frame.origin.y = 50.0f;
[scrollView addSubView:button1];

// First half of content view
button2.frame.origin.x = 110.0f; // NOTE that 110 is outside of
button2.frame.origin.y = 50.0f;  // the scroll view frame
[scrollView addSubView:button2];

, , NIB, Interface Builder, - . , IB.

, .

+7

.hidden.

YES → myscrollview.hidden = YES; NO → myscrollview.hidden = NO;

/ .

look-up " " - .

0

All Articles