Reputation: 2863
I am new to Objective-C.
It has TableViewCell
and the TableView
on the ViewController
like the following picture.
I want to change the View to another Viewcontroller
when I click the TableViewCell
.
But it seems can not use the performSegueWithIdentifier
to change the View
in didSelectRowAtIndexPath
without using UINavigationController
, The error log like the following:
Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
Is there has another way to change the View to another Viewcontroller
when I click on the TableViewCell
?
Thanks in advance.
Upvotes: 0
Views: 45
Reputation: 15669
In Interface Builder(storyboard) click the following:
Exactly what the debugger says: Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
Then you'll be able to push segues.
Upvotes: 1
Reputation: 31
U can present view controller using this
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
yourViewController *vc = [[yourViewController alloc]initWithNibName:@"yourViewController" bundle:[NSBundle mainBundle] ];
[self presentViewController:vc animated:YES completion:nil];
}
Upvotes: 1