How to pass custom object as parameter during URL navigation in Three20
Introduction
Three20 provides a great way to navigate between different URL using web liked URL format. Parameters are passed as a NSString format. For example you can define a URL in your Three20 project as "tt://products/(initWithProductId:)", all request to "tt://products/[PRODUCT ID]" will goes to the product detail view controller and initialized with the "initWithProductId:" method.
However it is not desired to pass this minimum information for initialization every time, sometimes we want something extra, such as a long string, or even a few parameters, it is just not convenient to use URL to present the information.
Solution
If your view is using TTTableViewController, when a cell is being selected, it will trigger "didSelectObject: atIndexPath:" method, so that you could do is create a custom TTURLAction and passing your custom object to the destination view controller.
If you are not using TTTableViewController, you can still create your custom TTURLAction object to achieve the same result:
In the destination view controller, initialize with following method:
Just a little bit more information and reminder, in the app delegate, don't forget to create the URL mapping:
That's it. The solution is simple enough.
