4
나는 방금 그것이 얼마나 쉬운 지 알았다 (또는, 최소한 있어야한다) state persistence with Three20 library. 그러나 탭 표시 줄 (UITabBarController
)과 함께 URL 매퍼를 사용하는 방법을 알아낼 수 없습니다.Three20의 URL 기반 탐색 + 탭 막대 예제?
상황은 이것이다 :
- 내가 그들을 위해 네 개의 탭과 다른 컨트롤러가 :
FirstViewController
,SecondViewController
,ThirdViewController
및FourthViewController
을. - 각각을
tt://tabs/first
...,tt://tabs/fourth
에 매핑하고 응용 프로그램을 닫을 때 어딘가에 저장하여 응용 프로그램이 다시 시작될 때 이전에 본 탭이 자동으로 열리도록하십시오.
내 코드 지금까지 :
// Init the tab bar
tabBarController = [[UITabBarController alloc] init];
[tabBarController setDelegate:self];
// Init the navigator
TTNavigator *navigator = [TTNavigator navigator];
[navigator setWindow:window];
[navigator setPersistenceMode:TTNavigatorPersistenceModeAll];
// Begin mapping
TTURLMap *map = [navigator URLMap];
[map from:@"tt://tabs" toViewController:[UIViewController class]];
[map from:@"tt://tabs/first" toViewController:[FirstViewController class]];
[map from:@"tt://tabs/second" toViewController:[SecondViewController class]];
[map from:@"tt://tabs/third" toViewController:[ThirdViewController class]];
[map from:@"tt://tabs/fourth" toViewController:[FourthViewController class]];
// Try restoring
if (! [navigator restoreViewControllers]) {
// Open default
TTURLAction *defaultAction = [[TTURLAction alloc] initWithURLPath:@"tt://tabs/default"];
[defaultAction setParentURLPath:@"tt://tabs"];
[navigator openURLAction:defaultAction];
}
// Put view controllers to tab bar
[tabBarController setViewControllers:[NSArray arrayWithObjects:
[[FirstViewController alloc] init],
[[SecondViewController alloc] init],
[[ThirdViewController alloc] init],
[[FourthViewController alloc] init],
nil]];
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
어떻게 TTNavigator
가 마지막 탭을 연 열게 않으며,이 있는지 아무도 - FirstViewController
에 폴백하지?