저는 Objective-C를 처음 접했습니다.TableViewCell을 클릭하면 ViewController로보기를 변경할 수 있습니까?
다음 그림과 같이에 및 TableView
이 있습니다.
나는 내가 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
을 클릭하십시오.
미리 감사드립니다.
가 정확히 무엇을 디버거가 말한다 : 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];
}
고마워! 그것은 일하고있다! – Martin