I have a TTableView. The items in this table a mapped to an url, so that when I click on an item, another view appear with informations about this item. All these informations are attributes of a class. So, how can I build my TTableTextItem URL in order to transmit the class containing informations to the view responsible for the display of these informations ?
Thanks in advance.
One way of doing it is to use a TTURLAction. When the user selects a row in your table, which will call your didSelectObject (of TTTableViewController) method, extract the object or set of objects you want to pass and build a TTURLAction like this:
TTURLAction *action = [[[TTURLAction actionWithURLPath:@"tt://showUser"]
applyQuery:[NSDictionary dictionaryWithObject:user forKey:@"kParameterUser"]]
applyAnimated:YES];
Then open the action:
[[TTNavigator navigator] openURLAction:action];
The controller you want to open as a result of this action should be registered in your TTURLMap and should have a constructor thus:
- (id) initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query {
self = [super init];
if (self != nil) {
self.user = [query objectForKey:kParameterUser];
}
return self;
}
I tend to create categories on classes for objects I want to be able to open another controller and display themselves.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With