我正在关注教程here。在URL中传递本地对象
我的代码是:
- (void) didSelectObject:(id) object atIndexPath:(NSIndexPath*) indexPath
{
Group * group = (Group *)((RKMappableObjectTableItem *) object).object;
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
group.unread = 0;
[self.tableView reloadData];
TTURLAction *action = [[[TTURLAction actionWithURLPath:@"tt://group"]
applyQuery:[NSDictionary dictionaryWithObject:group forKey:@"kParameterUser"]]
applyAnimated:YES];
[[TTNavigator navigator] openURLAction:action];
}
我已经设置映射为:
[map from:@"tt://group" toSharedViewController:[TopicsViewController class]];
和我TopicsViewController内我都试过:
- (id) initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query {
但它没没有工作。就好像它找不到任何映射。为什么是这样?我究竟做错了什么?
UPDATE:
这里的基础上,建议更新的代码:
TTURLAction *action = [[[TTURLAction actionWithURLPath:@"tt://group"]
applyQuery:[NSDictionary dictionaryWithObject:group forKey:@"kParameterUser"]]
applyAnimated:YES];
[[TTNavigator navigator] openURLAction:action];
[map from:@"tt://group?" toSharedViewController:[TopicsViewController class] selector:@selector(initWithNavigationURL:)];
- (id) initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query
我究竟错在这里做什么?
我其实只是想要它调用initWithNavigatorURL:(NSURL *)URL查询:(NSDictionary *)查询,而不是另一个选择器...看到一些其他的例子,似乎没有人使用它? ..你能否详细说明。即使在上面的问题中我链接的three20文档..它没有使用? – adit
为什么你在init方法中关心navigatorURL?你为什么需要它?无论哪种方式,将您的选择器设置为@selector(initWithNavigatorURL :)。 – coneybeare
我实际上并不关心navigatorURL,我只关心被传入的对象..无论如何,我尝试了你的建议,但它仍然不起作用... – adit