2014-07-06 4 views
0

2 개의보기로 연결된 스토리 보드에 탭 막대 컨트롤러가 있습니다.탭 막대 컨트롤러 탭 막대 항목의 스토리 보드 클릭 이벤트

@interface Timeline_Overview : UIViewController<UITabBarDelegate>{ 
} 
@property (nonatomic, retain) IBOutlet UITabBarItem *PostImage; 

을 그리고하는 .m 파일 : 나는 .H 파일에 설정했던 2 (TimelineView)보기에서

-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item 
{ 

NSLog(@"test"); 
if(item.tag==2) 
{ 

    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 
    UITabBarController *TimeLine = [mainStoryboard instantiateViewControllerWithIdentifier:@"Post_Photo_One"]; 
    [self presentViewController:TimeLine animated:YES completion:nil]; 
} 
else 
{ 
    //your code 
} 
} 

그러나이 무효 여기

가있다 :(발생하지 않습니다 이 Storyboard

아무도 도와 줄 수

,369 : 스토리 보드에서 그림?

편집 : 여기

그것은 당신처럼 보이는 내 검사하고 작동하지 않습니다 :(

enter image description here

편집 2 :

여기

내 스토리 보드, 내가 설정 한 사용자 정의 클래스에 내 "Timeline_Overview"는 "Post Image"탭에서 작동하지만 작동하지 않습니다. ( enter image description here

답변

2

변경 관리자의 대리인이 변경되었습니다. 당신의 관련 클래스에 storyboarddelegate, 스크린 샷 참조 :

enter image description here

및 사용자 정의 탭 표시 줄에 신원 관리자를 변경하는 것을 잊지 마세요 :

enter image description here

+0

덕분에 유지 : 나는 내 질문에 편집이, 당신의 그림에서처럼이 있지만 작동하지 않습니다 :( – Nils

+0

I을 내 대답 편집, 현재 스크린 샷보기 – gran33

+0

그래도 작동하지 않습니다. "PostImage"탭을 클릭하면 무효화되지 않습니다. ( – Nils

1

당신이 경우 스토리 보드를 사용하여이 작업을 수행하십시오.

in FinishedLaunchingWithOptions

AppDelegate에에서 또한

UITabBarController *tabBar = (UITabBarController *)self.window.rootViewController; 
[tabBar setDelegate:self]; 
, <UITabBarControllerDelegate>

그리고 당신의 재생에 대한 다음

-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController 
{ 
    //Write your code here 
} 
+0

고맙습니다. .... –

관련 문제