Three20: Link TTTableItem to TTViewController

I want my table elements to display an expansion arrow and refer to another "details" screen. Pretty standard. 320 is expected to help with this.

In my TTListDataSource, I am doing now:

- (void)tableViewDidLoadModel:(UITableView *)tableView { [super tableViewDidLoadModel:tableView]; // Construct an object that is suitable for the table view system // from each domain object that we retrieve from the TTModel. for (Listing *result in [(id<SearchResultsModel>)self.model results]) { NSString *url = [NSString stringWithFormat:@"myapp://listing", result.theID]; TTTableSubtitleItem *item = [TTTableSubtitleItem itemWithText:result.title subtitle:result.desc imageURL:result.imageURL defaultImage:nil URL:url accessoryURL:nil]; [self.items addObject: item]; } } 

But I need to pass the object (not just the string) to the TTViewController when the TTTableItem button is pressed . I know that you can transfer the NSDictionary object to the TTViewController using: TTNavigator [[TTNavigator navigator] openURL: query: animated:] .

However, since I am trying to open this URL from TTTableItem , I don’t know how to use the openURL method with it, where I can pass the NSDictionary request NSDictionary , since all that is required for the NSString β€œURL”.

I read the discussion here , however I really really would like to avoid changing the source code of Three20. If it can be extended, it will be fine.

What is the easiest way to get my table element to open a TTViewController and pass in an object (e.g. NSDictionary ) ?

+4
source share
2 answers

If you look at http://three20.info/core/navigation , they will show you how to do this without overriding the didSelectObject method.

In a nutshell, you can assign a URL to an object (via the category for NSObject), which maps to the URL for the controller that hosts this table. Then the handler can open another URL that passes the corresponding objects in the query dictionary.

+3
source

All Articles