Dynamically loading hi-res images into UIScrollView - iphone

I've been looking into creating a gallery mode in my application.
The functionality will be identical to the built in Photos App.
Here's the flow:
1. You touch on a thumbnail and ...
2. a modal view displays a large detail version of the image
3. You have the ability to scroll horizontally through all the images in the gallery while in this modal view
I'm stuck on step 3.
How do I dynamically load hi res images into a scroll view? I understand I need to set the contentSize for the the scrollView but how do I do that when I've only selected and loaded one image? What delegate methods do I need to implement and what does the heavy lifting look like?
Thanks in advance!

Refer to the following example project from apple, it shows how to use a scroll view to scroll horizontally through some views, u shouod only need to change the conents of those views to contain ur images http://developer.apple.com/iphone/library/iPad/index.html#samplecode/PageControl/Introduction/Intro.html

Related

UIScrollViews and Dynamically Creating Pages

I want to be able to dynamically populate UIScrollView. Like how it is done for row views in UITableView. I have a class that takes in some parameters and creates the respective view when it scrolls. Currently I have 8 views.
These 8 views have different background image, image and label according to the page number it is currently in. However the basic skeleton for this view is the same. What i am doing right now is in ViewDidLoad I am creating 8 views and add them as subviews and scroll over.
I don't want to do this. I want to create three views and the rest i want to populate when the user scrolls a page and then a page etc. How do i do this? ANy pointers/tutorial?
First of all you calculate the ContentSize for the scrollview (when you want to use the iPad in landscapemode with 8 pages then the width should be 1024*8 = 8192px and the height 768px).
Then you should implement the UIScrollView Delegate method:
scrollViewDidEndDecelerating:
In this Method you check on which page you currently are with the contentOffset property of the scrollview and start updating your left and right hidden views..
Hope this helps you a bit.
Check the two most recent WWDC videos for two excellent sessions regarding expert use of UIScrollViews. Additionally you can review a brief tutorial here, written by the well known cocoa expert, Matt Gallagher.

how i can lazy load thumbnail images to scroll view vertically with pages?

i have photo gallery which loaded to scroll view vertically and i only want to load visible pages to avoid memory issues like table views did. Is there a way to do this? i am using core data to get images and there are more than 150+ images in it.
I used this: http://www.markj.net/iphone-asynchronous-table-image/ and I'd think it would help in your scenario as well
if you are using vertical only scroll you may use UITableView with custom UITableViewCell.
This way, you get the lazy load done.

Whats the approach to create a view similar to the one at apple app store

I wanted to know how can we design the view controller such that.., the upper half of the screen remains fixed and the below part of the screen can be navigated through.. !!
Should we use slipScreenController here ?
Your description sounds nothing like the Appstore app but the Appstore app simply has one vertical UIScrollView and another horizontal UIScrollView inside that for images.
If you are referring to browsing categories in AppStore then:
That is a tableView implemented in such way that it doesn't take the whole screen area. You need to create a UIViewController (not UITableViewController) and than add a tableView to the view (using Interface Builder or code). That way you can change the size and position of the tableView and use the remaining area of the view for something else, for example a UISegmentedControl above the tableView.
If you are reffering to reading description and images of single app then I think that UIScrollView is used for displaying images, not sure about the rest.

Special UIScrollView with multiple objects (3) on each page

What I want to accomplish is something like this:
Two different scrollViews, and each one scrolls horizontically. Each showing 3 images, and a half one (or 1/3th) piece of the next image in the datasource of the scrollview.
Does anyone know how to accomplish such a scrollview?
I also want to be able to tap an image to flip it and show some information and a button to the detail. (See lower scrollview).
Tapping it again would just show back the image, much like the coverflow ui inside itunes, but without the coverflow being 3D...
Any help is welcome :)
Thanks in advance,
Lewion
Scroll view doesn't have a datasource. What you are looking for is standard scrolling and nothing special.. So it is definitely doable... Check the scrolling and photo scroller sample codes from apple developer samples. For more implementations of scroll view check the scroll view suite sample code and read the scroll view programming guide.
The flip animation is also a standard animation for a view and is easily doable. For example, create a utility application for iphone. It has a flip side view. See how that animation is done.

Strategy to lazy load images for buttons within UIScrollView?

I have a horizontal UIScrollView that contains UIButtons (though it could be any object). I would like to only download images for these buttons as the user scrolls and they are seen. I would also like an activityindicator running on each button while the images are downloading. Here's what I've tried with results:
Check content offset of uiscrollview and download images for visible buttons. Problem: issues getting activity view shown within subclassed UIButton and not desired usability since images are only downloaded once scrolling stops.
Add subviews (not buttons) to the UIScrollview hoping to use the view's ViewController to initiate a downloaded on viewDidAppear. Problem: viewDidAppear never seems to get called (because I am using addSubView?).
I've seen other apps that do this kind of loading but need some guidance on the typical set-up. Ebay's app is a great example. All items have a default image until the item comes into view, then an activityindicator runs and the items unique image is downloaded.
Thanks for assistance.
Without actually trying it out, here's my idea:
You can use the UIScrollViewDelegate method scrollViewDidScroll: to find out when your scroll view finished scrolling and then use [UIScrollView contentOffset] to determine which part of the scroll view is visible and (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view to determine the button's position within the visible part of the scroll view. Have a method that checks if the button has had its image loaded yet and if not, load it and refresh the view if necessary.
Most such apps are using a UITableView, not a plain scroll view. Joe Hewitt's Three20 framework has a TTImageView class that can do lazy image loading and is pretty well suited to this kind of use.