이 문제는 설명하기가 너무 힘들어서 최선을 다할 것입니다.TTNavigation 전달 데이터
여러 사용자 프로필이 있습니다. 나는 그들이 같은 수업에서 모두 다루어지기를 바란다.
TT://User/1
TT://User/2
왜지도를 사용자 클래스에 매핑했는지를 매핑 할 수 있습니다.
그 외에도 어떤 사용자 ID를 가져올 지 사용자 클래스에 어떻게 알릴 수 있습니까?
이 문제는 설명하기가 너무 힘들어서 최선을 다할 것입니다.TTNavigation 전달 데이터
여러 사용자 프로필이 있습니다. 나는 그들이 같은 수업에서 모두 다루어지기를 바란다.
TT://User/1
TT://User/2
왜지도를 사용자 클래스에 매핑했는지를 매핑 할 수 있습니다.
그 외에도 어떤 사용자 ID를 가져올 지 사용자 클래스에 어떻게 알릴 수 있습니까?
이 두 링크를 확인 했습니까?
a. http://three20.info/article/2010-10-06-URL-Based-Navigation
먼저 URL을 컨트롤러에 매핑해야합니다. 보기를 표시하기 위해 URL을 호출하기 전에 URL 맵을 설정하려는 경우 AppDelegate에서 일반적으로이 작업을 수행합니다.
다음은 코드입니다.
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application {
TTNavigator* navigator = [TTNavigator navigator];
TTURLMap* map = navigator.URLMap;
// This is the default map. * = wildcard, any URL not registered will be
// routed to the TTWebController object at runtime.
[map from:@"*" toViewController:[TTWebController class]];
[map from:@"tt://catalog" toViewController:[CatalogController class]];
[map from:@"tt://user/(initWithId:)"
toViewController:[MyUserViewController class]];
[map from:@"tt://user/(initWithId:)"
toViewController:[MyUserViewController class]];
if (![navigator restoreViewControllers]) {
[navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://catalog"]];
}
}
// ...
@end
둘째,
@implementation MyUserViewController
- (id) initWithId:(NSNumber *)index {
if (self = [super initWithNibName:nibName bundle:nil]) {
// Do your initialization here.
// Get the index from a singleton data manager containing the "model."
}
return self;
}
@end
셋째 TTViewController 서브 클래스 앱 어디에서 URL로 이동합니다.
// Navigate to the URL.
[[TTNavigator navigator] openURLAction:[TTURLAction actionWithURLPath:@"tt://user/1"]];