2011-03-21 4 views
0

TTTabItem에서 Tab을 눌렀을 때 UIViewController를 열 수있는 방법을 말해 줄 수 있습니까?TTTabIcon을 클릭 할 때 UIViewController를 엽니 다.

URL 매핑은 애플 대리자로 수행됩니다

CGRect applicationFrame = [UIScreen mainScreen].applicationFrame; 

self.view = [[[UIView alloc] initWithFrame:applicationFrame] autorelease]; 
self.view.backgroundColor = TTSTYLEVAR(tabTintColor); 

_tabBar = [[TTTabStrip alloc] initWithFrame:CGRectMake(0, 0, applicationFrame.size.width, 41)]; 
_tabBar.tabItems = [NSArray arrayWithObjects:[[[TTTabItem alloc] initWithTitle:@"Anno 1834"] autorelease], nil]; 
[self.view addSubview:_tabBar]; 

지금 사용 TTTabStrip 아래에 또 다른의 UIViewController을 열 수있는 방법 : 다음

TTNavigator* navigator = [TTNavigator navigator]; 
navigator.supportsShakeToReload = YES; 
navigator.persistenceMode = TTNavigatorPersistenceModeAll; 

TTURLMap* map = navigator.URLMap; 
[map from:@"*" toViewController:[TTWebController class]]; 
[map from:@"tt://mannschaft" toViewController:[MannschaftController class]]; 

내보기 컨트롤러에서 내가 성공적으로 내 TTTabSTrip을 추가 한 TTURLMap?

덕분에,

답변

0

좋아 doonot, 내가 먼저 대리인으로 내보기 컨트롤러를 설정했다 :

- (void)tabBar:(TTTabBar*)tabBar tabSelected:(NSInteger)selectedIndex { 
     TTTabItem *tabItem = [tabBar.tabItems objectAtIndex:selectedIndex]; 
     NSLog(@" tabItem:%@, tabItem.title::%@", tabItem, tabItem.title); 

     if(selectedIndex == 0){ 
      UIViewController* viewController = [[TTNavigator navigator] viewControllerForURL:@"tt://ajax"]; 
      [self.view addSubview:viewController.view]; 
      [self.view addSubview:_tabBar]; 
     } 
    } 
:

- (void)loadView { 
    CGRect applicationFrame = [UIScreen mainScreen].applicationFrame; 

    self.view = [[[UIView alloc] initWithFrame:applicationFrame] autorelease]; 
    self.view.backgroundColor = TTSTYLEVAR(tabTintColor); 

    _tabBar = [[TTTabStrip alloc] initWithFrame:CGRectMake(0, 0, applicationFrame.size.width, 41)]; 
    _tabBar.tabItems = [NSArray arrayWithObjects:[[[TTTabItem alloc] initWithTitle:@"Ajax Wälläbärg"] autorelease], nil]; 
    _tabBar.delegate = self; 
    [self.view addSubview:_tabBar]; 
} 

를 그리고, 당신이 TTabItem 클릭하면, 대표는이 함수를 호출

목록의 첫 번째 항목은 물론 인덱스가 0 인 항목입니다. 이제 앱 대리인에서 url 매핑을 정의 할 수 있습니다. 예를 들어, TT의 경우 : // 아약스는 SponsorController를 호출되어 :

UIViewController* viewController = [[TTNavigator navigator] viewControllerForURL:@"tt://ajax"]; 

아약스는 애플 대리자에 정의되어

TTNavigator* navigator = [TTNavigator navigator]; 
navigator.supportsShakeToReload = YES; 
navigator.persistenceMode = TTNavigatorPersistenceModeAll; 

TTURLMap* map = navigator.URLMap; 
[map from:@"*" toViewController:[TTWebController class]]; 
[map from:@"tt://mannschaft" toViewController:[MannschaftController class]]; 
[map from:@"tt://ajax" toViewController:[SponsorController class]]; 

나는 helpes 바랍니다. 거기에 예제 나 튜토리얼이 거의 없다는 것이 정말 나쁜 것입니다. 건배

관련 문제