2011-11-29 20 views
0

SOLUTION:Blogpost對象的C不能訪問視圖 - 控制


進出口使用的應用程序開發鈦和我想創建一個新的模塊來擴展應用功能。

1)模塊啓動並運行 - 修復! 2)將「海關」/功能添加到模塊 - ERR。

我跟着這http://iosguy.com/2010/09/04/presenting-pdf-files-by-yourself/ 我真的不知道如何以及爲什麼我需要把這些功能,我如何創建提到的意見等等。

因此,繼承人什麼我走到這一步: 香港專業教育學院讀了comas3breezepdfModule.m文件是一個我需要這樣從上面的鏈接funcitons在這個.m文件粘貼到工作方式如下:

-(CGPDFDocumentRef)openDocument:(CFURLRef)url 
{ 
    CGPDFDocumentRef myDocument = CGPDFDocumentCreateWithURL(url); 
    if (myDocument == NULL) { 
     return 0; 
    } 
    if (CGPDFDocumentIsEncrypted (myDocument) 
     || !CGPDFDocumentIsUnlocked (myDocument) 
     || CGPDFDocumentGetNumberOfPages(myDocument) == 0) { 
     CGPDFDocumentRelease(myDocument); 
     return 0; 
    } 
    return myDocument; 
} 

-(CGPDFDocumentRef)document 
{ 
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"presentation" ofType:@"pdf"]; 
    NSURL *url = [[NSURL alloc] initFileURLWithPath:filePath]; 
    CGPDFDocumentRef pdfdocument = [self openDocument:(CFURLRef)url]; 
    [url release]; 
    return pdfdocument; 
} 

- (void)load { 
    UIViewController* controller = nil; 
    NSInteger numberOfPages = CGPDFDocumentGetNumberOfPages([self document]); 
    for (NSInteger pageIndex = 1; pageIndex <= numberOfPages; pageIndex++) { 
     CGPDFPageRef page = CGPDFDocumentGetPage([self document], pageIndex); 
     PDFPageView *pageView = [[PDFPageView alloc] initWithFrame:scrollView.bounds]; 
     pageView.page = page; 
     pageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 
     pageView.autoresizesSubviews = YES; 
     pageView.backgroundColor = [UIColor whiteColor]; 
     [scrollView addSubview:pageView]; 

     [pageView release]; 
    } 
} 

我然後嘗試創建一個新的viewcontroller子類,我得到一個PDFPageView.h和PDFPAgeView.m文件...但是,我曾嘗試和測試我仍然最終成爲負載函數中創建pageView對象的一堆錯誤。

如下:

comas3breezepdfModule.m: error: Semantic Issue: Use of undeclared identifier 'scrollView'; did you mean 'UIScrollView'? 
comas3breezepdfModule.m: error: Semantic Issue: Property 'page' not found on object of type 'PDFPageView *' 
comas3breezepdfModule.m: error: Semantic Issue: Property 'autoresizingMask' not found on object of type 'PDFPageView *' 
comas3breezepdfModule.m: error: Semantic Issue: Property 'autoresizesSubviews' not found on object of type 'PDFPageView *' 
comas3breezepdfModule.m: error: Semantic Issue: Property 'backgroundColor' not found on object of type 'PDFPageView *' 
comas3breezepdfModule.m: error: Semantic Issue: Unknown receiver 'scrollView'; did you mean 'UIScrollView'? 
comas3breezepdfModule.m: warning: Semantic Issue: Method '+addSubview:' not found (return type defaults to 'id') 

任何人都可以點我到正確的方向?

最糟糕的部分是我每天都在使用Java,JS,AS3,但只要我用xCode打開某些東西,我的頭腦就會變得空白,我甚至不知道函數是什麼。 一直試圖理解這裏的邏輯在這裏時間最長的5周現在,但它感覺像我即將倒退,理解更少...

回答

0

所有的錯誤表明編譯器無法找到各種參數的聲明。請確認您已添加適當的頭文件併合成了所有已聲明的屬性。

+0

嗯。我實際上不確定。 這是我的PDFPageView.h內容: '#進口 @interface PDFPageView:的UIViewController { 的UIScrollView *滾動視圖; CGPDFDocumentRef * pdfdocument; } - (void)scrollViewDidScroll:(UIScrollView *)scrollView; (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; @ end' 我試着綜合PDFPageView.m文件中的scrollView和pdfdocument,但那些也生成錯誤 – Deko

0

你應該顯示你的.h文件,並在其中生成錯誤,有幾種可能性,其中之一是PDFPage類不在你的搜索路徑....通常文件夾(lib .. )存儲框架的位置,修復方法是通過單擊應用程序圖標並修改構建設置來添加搜索路徑....搜索路徑!