iphone - Display Pageviewcontroller using storyboard segue -


i have pageviewcontroller want display , in project using storyboard , segue

nsstring *path = [[nsbundle mainbundle] pathforresource:@"paper" oftype:@"pdf"]; pageviewcontroller *page = [[pageviewcontroller alloc] initwithpdfatpath:path]; //[self presentviewcontroller:page animated:no completion:null]; 

if use statement

//[self presentviewcontroller:page animated:no completion:null]; 

then doesn't display navigation bar , backbarbuttonitem

and when remove statement

 //[self presentviewcontroller:page animated:no completion:null]; 

then doesn't display pageviewcontroller using curl effect transition turning page on displays navigation bar , backbarbuttonitem.

and when replace statement

//[self presentviewcontroller:page animated:no completion:null]; 

with statement

[self.view addsubview:page.view]; 

then displays pageviewcontroller doesn't turn page on @ all.

please help.

thanks lot.

i think see issue. since have segue set in storyboard, don't have call presentviewcontroller. think want in prepareforsegue function:

- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {     if ([[segue destinationviewcontroller] iskindofclass:[pageviewcontroller class]]) {         nsstring *path = [[nsbundle mainbundle] pathforresource:@"paper" oftype:@"pdf"];         pageviewcontroller *page = (pageviewcontroller *)[segue destinationviewcontroller];         [page initwithpdfatpath:path];     } } 

also, if push segue not built storyboard, should able use current code 1 modification:

nsstring *path = [[nsbundle mainbundle] pathforresource:@"paper" oftype:@"pdf"]; pageviewcontroller *page = [[pageviewcontroller alloc] initwithpdfatpath:path]; [[self navigationcontroller] pushviewcontroller:page animated:yes]; 

hope helps.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -