0
votes

Have two segue in my storyboard. One segue shows navigation bar and navigation item when pushed but second segue doesn't shows navigation bar when pushed

This my code for pushing second segue

- (IBAction)ReadAction:(id)sender {

[self performSegueWithIdentifier:@"MySegue" sender:sender];

 }


- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"MySegue"]) {

    // Get destination view
    PDFViewController *pdfviewController = [segue destinationViewController];
}
}

In the storyboard navigationbar and navigation bar title is showing for both segue in storyboard and navigationcontroller is set as rootviewcontroller that is why it is showing in first segue but i wonder why it is not showing only for second segue when execute

Edit:

Solved little bit but still have problem

The view controller which i was trying to push

In that view controller had code like this

 NSString *path = [[NSBundle mainBundle] pathForResource:@"Paper" ofType:@"pdf"];
PageViewController *page = [[PageViewController alloc] initWithPDFAtPath:path];
//[self presentViewController:page animated:NO completion:NULL];

When i commented out this statement from above code then it shows navigation bar and backbuttonitem that is what i was looking for

 [self presentViewController:page animated:NO completion:NULL];

but now after commenting it doesn't displays pageviewcontroller in the pushed view controller.

Now how can i display pageviewcontroller.

Edit:

Just added

[self.view addSubview:page.view];

but now another problem pageviewcontroller is displaying with navigation bar and all that but now not turning pages over using curl effect with previous commented statement it was turning pages over

Help will be really appreciated.

Thanks.

1
you need to set the navigation controller - Apollo SOFTWARE
but in the storyboard navigationbar and navigation bar title is showing and navigationcontroller is set as rootviewcontroller that is why it is showing in first segue but i wonder why it is not showing in second segue when execute - user1120133

1 Answers

0
votes

I think the below should work for your needs. One pushes and one presents simply.

 PDFViewController *pdfviewController = [segue destinationViewController];

 [self.navigationController presentViewController:pdfviewController animated:YES];

or

[self.navigationController pushViewController:pdfviewController animated:YES];

Try both.