Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone PrepareforSegue未显示destinationviewcontroller_Iphone_Objective C_Ios6_Uistoryboardsegue - Fatal编程技术网

Iphone PrepareforSegue未显示destinationviewcontroller

Iphone PrepareforSegue未显示destinationviewcontroller,iphone,objective-c,ios6,uistoryboardsegue,Iphone,Objective C,Ios6,Uistoryboardsegue,Segue destinationviewcontroller pdfviewcontroller不显示页面ViewController - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"MYSegue"]) { // Get destination view PDFViewController *pdf

Segue destinationviewcontroller pdfviewcontroller不显示页面ViewController

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

    // Get destination view
    PDFViewController *pdfviewController = [segue destinationViewController];
    NSString *path = [[NSBundle mainBundle] pathForResource:@"paper" ofType:@"pdf"];
    PageViewController *page = [[PageViewController alloc] initWithPDFAtPath:path];
    pdfviewController= page;

}
}
- (void)viewDidLoad {
    [super viewDidLoad];

    PageViewController *page = [[PageViewController alloc] initWithPDFAtPath:self.path];
    page.view.frame = self.view.bounds;
    [self.view addSubview:page.view];
    [self addChildViewController:page];
    self.page = page;
}
仅显示导航栏和backbuttonitem

并显示从pageviewcontroller strong分配给pdfviewcontroller strong的语义问题不兼容指针类型

谢谢你的帮助。

这行错了:

pdfviewController=第页

正如编译器告诉您的,类型是
PDFViewController*
,您正在尝试分配
PageViewController*

你是说:

pdfviewController.page = page;

segue应该只做:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"MYSegue"]) {
        // Get destination view
        PDFViewController *pdfViewController = [segue destinationViewController];
        NSString *path = [[NSBundle mainBundle] pathForResource:@"paper" ofType:@"pdf"];

        pdfViewController.path = path;
    }
}
向pdf视图控制器添加一些属性:

@property (copy, nonatomic) NSString *path;
@property (strong, nonatomic) PageViewController *page;
然后在pdf视图控制器中

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

    // Get destination view
    PDFViewController *pdfviewController = [segue destinationViewController];
    NSString *path = [[NSBundle mainBundle] pathForResource:@"paper" ofType:@"pdf"];
    PageViewController *page = [[PageViewController alloc] initWithPDFAtPath:path];
    pdfviewController= page;

}
}
- (void)viewDidLoad {
    [super viewDidLoad];

    PageViewController *page = [[PageViewController alloc] initWithPDFAtPath:self.path];
    page.view.frame = self.view.bounds;
    [self.view addSubview:page.view];
    [self addChildViewController:page];
    self.page = page;
}

我想在PDFviewController中显示pageviewcontroller,但它们是什么?它们是你的吗?你是从github买的吗?你认为它们是如何结合在一起的?如果你看看我的这个问题,你可能会理解我的问题。感谢您的时间和帮助。您不应该再次发布相同的问题,而应该编辑原始问题。另外一个问题没有说明任何关于类定义的内容。为什么要尝试使用2个视图控制器,它们之间的关系应该是什么(为什么不封装在PDF视图控制器中)?可能重复