iPhone - Create an images grid list - iphone

I'm developing an application that get images from a website and display to user with a grid view like Photo app by Apple.
When you tap on an image I would to push a view controller that displays images info and other stuff.
What's the better way to implement this? I thought a custom UITableViewCell. (I've seen there are Three20 and AQGridView libs but I'm a newbie developer and the docs are very very poor. Hints?)
Thanks.

I think the UITableView is the best way of doing it. Its memory efficient and your only going to display 3 images anyway so the overhead isn't that bad. A tip, when your asynchronously getting images from the website, create a custom view is a delegate of NSURLRequest, get the data from a webpage, parse the data into a UIImage using imageWithData and when the finished delegate method is called, put a imageview on top of the custom view. This is the best method of downloading asynchronous methods. Good luck!

I made a thumbnail grid list like tableView but multicolumn, it's open source, on
http://www.cocoacontrols.com/platforms/ios/controls/thumbnail-list-view
https://github.com/mohammedDehairy/ThumbnailList

Related

Replace UITableView and UITableViewController with Three20

Hi i have a working UITableViewController and UITableView with custom cells but i want to add some async functionality from Three20, so i would like to migrate my current classes to the ones from Three20, TTTableViewController and TTTableViewController, to use the TTImageView inside of my custom cell.
The functionality would be download asynchronously an image for an imageView.
Apart from these i want the cache func.
Thanks in advance.
Why switch to Three20 for this? Why not just use the async functionality already present in the system, and use something like NSCache for caching your images you download? What you suggest you want to do smells real bad for what your end goal is.

Cocoa-Touch: Is there any open-source UIImageView subclass that supports touchUpInside and initWithUrl?

It's been more than 3 years since Cocoa-Touch is out, the licensing is permissive now.
Many, many apps have UIImageViews that are actually buttons, and load from the internet.
Is there any open UIImageView subclass (or similar) that supports:
adding a target for the touchUpInside event (maybe others too)
initializing with a NSURL, loading the image from that URL (async ofc) and displaying a UIProgressIndicatorView while loading
Or is everyone pretty much rolling their own for this?
It seems to be such a common thing, yet google has no good hits.
You wouldn't want the UIImageView derived class to load its image--especially if it's in a table view because when the user scrolls the table view, the image that will display in the image view would need to change. If you are assigning a specific image to a specific image view within a table view, you run the risk that the image displaying will be out of date by time the image data has actually returned.
While I wouldn't call it trivial as Daniel said, I would say that it is simple enough that you could probably code it up fairly quickly. The idea though is that you want to have some other class, a singleton perhaps, that handles all of your image download requests and then notifies your view that contains your image view that the images are available when the requests complete.
You should also consider that you can set an image for a UIButton, so then you wouldn't need to derive your own UIImageView if all you need is -touchUpInside. You could create an action for the button and implement it pretty easily.

How to prevent image view loading while scrolling in iPhone?

I am new to iPhone development. I want to check whether the image is loaded in the image view and if the image view is nil then load the image. I want to implement this in cell for row at index path so that I can increase the scrolling performance of the table. How can I do that?
Luckily Apple provides a sample that does just this, LazyTableImages. You can move IconDownloader into your project and then change your TableViewController implementation to look like that of RootViewController

Progressive download of images in a UITableView

I'm developing on the iPhone and I have seen in the AppStore that the images are progressively downloaded in the UITableView... How can I implement that?
My idea was to detect the showed content (which cells are shown) and download these images. My problem is that I don't know how to detect the showed cells!
Is it the good way to do it?
Best
The way this was demonstrated at the iPhone Developer Tech Talk was to use NSOperation and NSOperationQueue.
The idea is to wrap up your image download request (using NSURLRequest) into an NSOperation.
You can set your cell as the receiver of a call back sent by your operation when it's complete so that you can attach the image to the cell (draw it manually, or add it to an image view).
Then basically, in your cellForRowAtIndexPath method, tell the cell to start the image download, and have the cell create an NSOperation and add it to the operation queue managed by your table view controller or something.
The queue will start executing the operations and call back to each cell when they're done.
If you want to, you can cancel the operation if the cell moves offscreen, so you don't waste resources downloading an image that will be thrown away because the cell won't be visible to display the image.
Here's an example of how to do this that implements the basic idea that Jasarien talks about. It may be sufficient depending on your application's needs and is generally good example of how to do it if it isn't.
I would implement each cell as a subclass of UITableViewCell and then override willMoveToWindow: method in the subclass. willMoveToWindow: is called when the cell view becomes visible on the screen or when it goes off screen (newWindow gets nil). Then each cell can queue a request to load its image as it becomes visible (and maybe even cancel its queued request if it goes off screen).
BTW, You can use the visibleCells property of UITableView to get the list of cells that are visible.
#Jasarien: nice answer
Or you can use the three20 project if you want. there is a TTTableViewController that already handles all the stuff you want. you only have to input the URL to the imageview and viola.
TT also caches your images in memory or also on disk.
check out the sample project bundled in three20 gitbub ressource. there an example.
That is calles LazyTableView...You can gt tutorial from here
http://developer.apple.com/library/ios/#samplecode/LazyTableImages/Introduction/Intro.html
Please go through this link , and try to integrate Lazy table view load , you can achieve you output , http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/ change the url in ProgressiveImageDownloadViewController in Download button click method.

Best way to Swipe through Photos on iPhone?

im trying to make a image gallery and the user swipes through views like on the Photo app on the iphone. i heard page control was very good but it has a limit of 20 bullets and i need more swipes. what would you guys recommend?
Check out the Three20 framework. You're job is almost done for you.
Either the three20 as said or a scroll view (without paging) and an uiimageview inside that with uiimages.