URL navigation in three20
I am fairly new to three20 so bear with me. I have the following code which loads objects to the data source:
- (void)loadView {
[super loadView];
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
RKObjectTTTableViewDataSource* dataSource = [RKObjectTTTableViewDataSource dataSource];
[dataSource mapObjectClass:[Group class] toTableCellClass:[CCell class]];
RKObjectLoader* objectLoader = [[RKObjectManager sharedManager] objectLoaderWithResourcePath:@"/groups.j开发者_C百科son" delegate:nil];
dataSource.model = [RKObjectLoaderTTModel modelWithObjectLoader:objectLoader];
self.dataSource = dataSource;
}
I have set up a URL map in the appdelegate as follows:
TTNavigator *navigator = [TTNavigator navigator];
navigator.window = self.window;
TTURLMap *map = navigator.URLMap;
[map from:@"tt://topics/(initWithTopicsIndex:)"
toSharedViewController:[TopicsViewController class]];
I would like to push another controller when I tap on the cell, how do I do this? Can I do this via the setObject in the TTTableViewCell?
Your item class needs to return the URL you want to navigate to in the URLValue method. URLValue is implemented in a category on NSObject and uses the URLMap to create URL for objects.
If your item is subclass of TTTableLinkedItem, it has a URL property, which is used instead.
Have a look at [TTTableViewController didSelectObject:(id)object atIndexPath:(NSIndexPath*)indexPath]
and [TTTableViewDelegate tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath]
精彩评论