我自己想出来的,对于那些需要它的人:
首先(在导航器地图中传递“subURLs”)
可以使用@“tt://photos/firstphoto”导航到 URL,您可以像这样获取“firstphoto”:
//Prepare your Navigator Map like this
[map from:@"tt://photos/(initWithNumber:)" toViewController:[PhotoVC class]];
在您的 PhotoVC 中,您可以访问此号码:
-(void) initWithNumber: (NSString*)number {
NSLog(@"%@",number);
}
用这个 url 调用你的 View Controller 看起来像:
PhotoVC* controller = [[PhotoVC alloc] initWithNumber:@"1"];
[navigationController pushViewController:controller animated:YES];
[controller release];
第二(在 TTTableViewController 中传递对象)
它有点棘手,但你不必对任何东西进行子类化。
首先,将 TableItem 中的 URL 设为 nil
[TTTableLink itemWithText:@"TTTableLink" URL:nil]
在你的 TTTableViewController 中写下这个方法
- (void)didSelectObject:(id)object atIndexPath:(NSIndexPath*)indexPath {
TTURLAction *urlAction = [[[TTURLAction alloc] initWithURLPath:@"tt://photos"] autorelease];
urlAction.query = [NSDictionary dictionaryWithObject:@"firstphoto" forKey:@"photo"];
urlAction.animated = YES;
[[TTNavigator navigator] openURLAction:urlAction];
}
现在在你的 PhotoVC 中你需要这样的东西
- (id)initWithNavigatorURL:(NSURL*)URL query:(NSDictionary*)query {
if (self = [super init]) {
NSLog(@"%@",query);
}
return self;
}
你就完成了;)