我已经创建了厦门国际银行在文件中PDFView
一个NSWindow
,我创建了一个名为MainController控制器,在那里,我创建了一个IBAction为-(IBAction) openFileAction:(id) sender
,它使用的方法设置文档以PDFview中的控制器构造
-(void) openFile:(NSString *) path{
NSLog(@"Opening File %@",path);
PDFDocument *pdfDoc = [[PDFDocument alloc] initWithURL:[NSURL fileURLWithPath:path]];
[pdfView setDocument: pdfDoc];
}
我将打开的菜单项链接到openFileAction
,并在点击后PDF文件正确显示在PDFView中。
我做一个逻辑接收命令行参数
-(MainController *) init{
[super init];
NSArray *myArgs = [[NSProcessInfo processInfo] arguments];
NSLog(@"pdf view %@", pdfView);
if ([myArgs count] >= 2){
[self openFile:[myArgs objectAtIndex:1]];
}
return self;
}
正如你所看到的,我确实在默认的构造函数,并在这方面pdfView为null,则该文件未打开后的重写应用程序/主窗口加载。
我的问题是,如何在应用程序加载后在PDFView中打开PDF? UI加载后是否有任何钩子?