在iphone中加载页面时出错?

时间:2011-12-07 10:22:44

标签: iphone objective-c ios

上一页:

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

- 转换到下一个视图页面: -

- (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];
}

我无法传输字符串值和

- 在仅变换图层中更改属性不透明将无效

页面未转移到下一个视图

有人可以帮忙吗?

1 个答案:

答案 0 :(得分: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);
 }