2011-12-07 94 views
-1

前一頁:在iphone中加載頁面時出錯?

MainController *bookview=[[MainController alloc]init]; 
    bookview.bookString=booksStr; 
    [self.navigationController pushViewController:bookview animated:YES]; 

-transform到下一個視圖頁面: -

- (NSInteger) numberOfPagesForPageFlipper:(AFKPageFlipper *)pageFlipper { 
    return self.view.bounds.size.width > self.view.bounds.size.height ? ceil((float) CGPDFDocumentGetNumberOfPages(pdfDocument)/2) : CGPDFDocumentGetNumberOfPages(pdfDocument); 
} 


- (UIView *) viewForPage:(NSInteger) page inFlipper:(AFKPageFlipper *) pageFlipper { 
    PDFRendererView *result = [[[PDFRendererView alloc] initWithFrame:pageFlipper.bounds] autorelease]; 
    result.pdfDocument = pdfDocument; 
    result.pageNumber = page; 

    return result; 
} 

-(void)viewDidLoad 
{ 
    self.title=bookString; 
    NSLog(@"the bookstring value is %@",bookString); 

} 
#pragma mark - 
#pragma mark View management 


- (void) loadView { 
    [super loadView]; 
    self.view.autoresizesSubviews = YES; 
    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 

    flipper = [[[AFKPageFlipper alloc] initWithFrame:self.view.bounds] autorelease]; 
    flipper.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 
    flipper.dataSource = self; 
    NSLog(@"loadview loaded successfully %@",bookString); 
    [self.view addSubview:flipper]; 
} 


#pragma mark - 
#pragma mark Initialization and memory management 


- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
    return YES; 
} 


- (id) init { 
    if ((self = [super init])) { 
     pdfDocument = CGPDFDocumentCreateWithURL((CFURLRef) [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"AppleScript Language Guide" ofType:@"pdf"]]); 
     NSLog(@"this is maincontroller"); 
     [self loadView]; 
    } 

    return self; 
} 


- (void)dealloc { 
    CGPDFDocumentRelease(pdfDocument); 
    [super dealloc]; 
} 

,我不能夠轉移字符串值,並

- 改變屬性的變換 - 不透明只有圖層,將不起作用

頁面不轉移到下一個視圖

任何人都可以幫忙嗎?

回答

0
MainController *bookview=[[MainController alloc]init]; 
bookview.bookString=booksStr; 
[self presentViewcontroller:bookview animated:YES]; 

MainController.h

NSString *bookview; 

組屬性;

@property (nonatomic, retain) NSString *bookview; 

MainController.m

@synthesize bookview; 
-(void)viewDidLoad 
{ 
     NSLog(@"%@",bookview); 
} 
+0

presentviewcontroller工作正常,但值不是在所有從oneview解析到另一個 – Marios

+0

- 改變特性不透明在變換唯一的層,將沒有任何效果我; m得到像這樣的警告和字符串值根本沒有解析 – Marios

+0

或你會使用appdelegate方法 – akk