If we start with the photos app for example. The images can be viewed with a swipe and the images scroll into view as the user swipes.
How is this kind of UIScrollView setup and how are the Images (e.g. from an array) displayed within this UISCrollView?
Are the images added to the scrollview at once or how is this paging look achieved?
Thanks
This can be achieved using a main UIScrollView with pagingEnabled set to YES and containing nested UIScrollViews. Then you can put an UIImageView in each one of these nested scroll views, so you can also achieve zooming by returning it to - (UIView *)viewForZoomingInScrollView:
Also, you can take a look at these samples from Apple:
http://developer.apple.com/library/ios/#samplecode/Scrolling/Introduction/Intro.html
http://developer.apple.com/library/ios/#samplecode/ScrollViewSuite/Introduction/Intro.html
Related
I am developing an app. In which we are placing UIScrollView and buttons & images on UIScrollView.Images are at the bottom of the UIScrollView and Buttons are at top of the UIScrollView.
Problem is that I want to scroll only images not buttons. Is it possible to scroll only some part in UIScrollView. If possible how can we achieve it.
Any one can help or suggest with links.
Instead of putting the buttons on the UIScrollView, make the UIScrollView smaller and add the buttons to the same parent view as the UIScrollView.
You can take another scrollview and add images on it. So that if you scroll the images your buttons will not move.
Create 2 scrollviews, one for button & one for images. Then set scrolling disabled for the one with buttons.
In my application i want to load more then one view inside scrollview and also give more no.of imageview inside each and every view...if give so,is it clickable is possible...
give me a solution to do this...
Thank You,
Varshu
Try PhotoScroller sample application. This application demonstrates the use of embedded UIScrollViews and CATiledLayer to create a rich user experience for displaying and paginating photos that can be individually panned and zoomed. CATiledLayer is used to increase the performance of paging, panning, and zooming with high-resolution images or large sets of photos.
What I want to do is displaying pages of a brochure at the iPad Display and allow the user to flip through the pages (left to right & right to left). The user should also be able to zoom in to articles at the pages.
I tried it with laying an UIImage into a UIImageView and then this UIImageView to a ScrollView. This works only if I have one Page. The second page is not displayed.
What would be the best way to do this ?
Set your scrollview pagingEnabled property to true, then set the contentSize to a size thats the sum of widths of all the imageviews. You then add each UIImageView to the UIScrollView making sure to position them next to each other.
Here is a tutorial talking about this: http://kwigbo.com/post/758575763/uiscrollview-image-gallery-tutorial
I'm not sure about enabling zoom but that should get you paging through image views.
I'm developing my first iPhone app and I would greatly appreciate you guy's input on a problem I'm having.
I'm looking to implement scrolling both horizontally and vertically. I want the horizontal scrolling to be paged, without the vertical one being paged (scrolling "normally"). A single UIScrollView with pagingEnabled set to YES will page in both directions. The natural solution would be to nest a UIScrollView inside another one, however when I do that, I can't get the "inner" UIScrollView to scroll at all. Seems the outer one is "eating" up all the tap events, like in:
UIScrollView : paging horizontally, scrolling vertically?
I read something about "inner scrolling" being improved upon in SDK 3.0 and actually when I add an inner UITableView instead of a UIScrollView the scrolling works flawlessly. Since UITableView subclasses UIScrollView I imagine that my desired behavior should be achievable by making my own subclass of UIScrollView.
Is this the right approach? If so, what should this subclass look like?
This works out of the box with the SDK now. See Scrolling Madness and Apple's UIPageControl sample for guidelines on how to implement paged horizontal scrolling with a view controller for each page.
The nested UIScrollViews you add as subviews to your outer UIScrollView should have the same frame heights as the container. If you do this then the outer UIScrollView will pass through the vertical scrolling events to the subview. My app has three levels of UIScrollView and UIWebView nesting and I've found Cocoa is really intelligent about passing the events to the one I want as long as I set my frame sizes so that only one view is really scrollable (contentSize > frame) on each axis.
If you are trying something like Twitter profile UI I achieved this by putting header view and bottom scrollview in a a parent scrollview and underlaying another scrollview behind.
Underlaying scrollview is responsible for the adjusting content offsets of header and bottom. Its contentsize is also adjusted by the inner item heights.
It looks complicated when I tell, better see the code
https://github.com/OfTheWolf/Twitterprofile
I've been using this great lib by Andrey Tarantsov for months: SoloComponents
You can use it as an "horizontal UITableView" with support for pagination and view recycling.
Well made and perfectly cocoa-style designed.
Based on Dylan's answer, in my case, I actually also had to make content size heights equal for both parent and nested UIScrollViews to make nested UIScrollView to scroll vertically. Making only "the same frame heights as the container" as Dylan explained was not enough:
parentScrollView.contentSize = CGSizeMake(parentScrollView.contentSize.width, desiredContentHeight);
nestedScrollView.contentSize = CGSizeMake(nestedScrollView.frame.size.width, desiredContentHeight);
What Dylan says. And, perhaps of interest on this topic - you do not need to enable scrolling in the master "paging" UIScrollView, just enable paging and direction lock. This seems to assure that all vertical scrolling cues go to the nested, fixed-size, vertical-scrolling NSScrollViews. It works back to at least iOS 9.
i am new developer on iphone and i am working on a project. the problem i am having is that i have no idea about how to create a horizontal scroll view of images. what i want is that when i click on the table view containing image thumbs, i should view the same image in a much larger size and scroll the other images that are on the left and the right.
The class you want is UIScrollView. You can add multiple UIImageViews to a UIScrollView.
In addition to ScollingMadness recommended by luvieere, check out Apple's UIScrollView sample code which is referneced from the Xcode UIScrollView documentation.