2014-04-11 3 views
0

저는 Objective-C를 처음 접했습니다.TableViewCell을 클릭하면 ViewController로보기를 변경할 수 있습니까?

다음 그림과 같이에 및 TableView이 있습니다.

enter image description here

나는 내가 TableViewCell를 클릭하면 다른 Viewcontroller로보기를 변경하고 싶습니다.

하지만 UINavigationController를 사용하지 않고 didSelectRowAtIndexPath에서 View을 변경하려면 performSegueWithIdentifier을 사용할 수 없습니다 것 같다,이 오류는 다음과 같이 기록 :

Push segues can only be used when the source controller is managed by an instance of UINavigationController.' 

다른 Viewcontroller에보기를 변경하는 또 다른 방법이있는 경우는 I TableViewCell을 클릭하십시오.

미리 감사드립니다. enter image description here

가 정확히 무엇을 디버거가 말한다 : Push segues can only be used when the source controller is managed by an instance of UINavigationController.' 그런 다음 당신은 할 수 있습니다 U는이

인터페이스 빌더 (스토리 보드)에서
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
    yourViewController *vc = [[yourViewController alloc]initWithNibName:@"yourViewController" bundle:[NSBundle mainBundle] ]; 
     [self presentViewController:vc animated:YES completion:nil]; 

    } 

답변

1

다음 클릭하여 뷰 컨트롤러를 제공 할 수

+0

고마워! 그것은 일하고있다! – Martin

1

섹스를 밀어 붙이기.

+0

'yourViewController * vc = [[yourViewController alloc] initWithNibName : @ "yourViewController"번들 : [NSBundle mainBundle]];'에서'Expected identifier '오류가 발생했습니다. 오류가 발생한 이유를 알고 있습니까? – Martin

+0

#import "yourViewController" –

+0

죄송합니다 ... 오류가 여전히 존재했습니다 ... – Martin

관련 문제