Replace UITableView and UITableViewController with Three20 - iphone

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.

Related

iPhone - Create an images grid list

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

Creating a custom UIActivityIndicatorView

I want to have a custom view for UIActivityIndicatorView rather than relying on options given by iOS. How can I create my own view here?
I have a list of images with me to create a animated view.
As you haven't specified the case in which you want to use the activity indicator,
check the below tutorial blog for custom UIActivityIndicatorView,
Custom UIActivityIndicatorView (EDIT: This link is gone)
Showing a "Loading..." message over the iPhone keyboard
This is implementation of custom UIActivityIndicator from scratch ready for integrating.
Abhinav, if you want to use a set of images you could as well use a UIImageView. Set the animationImages and start-stop as you wish.
This one looks nice and clean, can be hooked to the code easily too.

TTThumbsViewController

Is it possible to add a TTThumbsViewController sub class on a UIView without uising TWNavigationController
Thanks
If what you're trying to do is use a portion of the TT framework, without using all of it... I'd consider one of the other thumbnail view controllers available. I like https://github.com/kirbyt/KTPhotoBrowser and https://github.com/enormego/PhotoViewer

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.

Three20 TTTableViewController with a TTThumbsTableViewCell

It seems that you must use the TTThumbsViewController to accomplish this. However, in the example code, TTThumbsViewController is only ever used to manage a scrollview of thumbs. How do you configure it to display cells instead?
_________Original Question_________
Has anyone used the Three20 source and made a tableview (not Fields)?
I am trying to figure out how to insert the TTThumbTableViewCell in a table and it none of the examples even address the tableviewcell classes (just the tablefields).
If you know how to setup a table to use these cell classes, can you post how you accomplished it?
Thanks
I haven't really used Three20 myself, but took a quick look on the source code.
It seems that Three20 have abstracted a creation of table view cells in generic TTTableViewDataSource. It queries class of a table view cell to be created via tableView:cellClassForObject:. TTThumbsDataSource in TTThumbsViewController.m then overrides that to return TTThumbTableViewCell class for TTPhoto objects.
So, if you are not using TTThumbsViewController, you should use TTThumbsDataSource as a dataSource for your table view or create your own similar class.
I was mistaken in how Three20 was setup.
A TTThumbsViewController is a Table view of TTThumbTableViewCells already. You just can't see the lines between the cells.
You can change the way the cells behave by subclassing TTThumbTableViewCells.