我有两个UIPopoverController
。当我点击相应的按钮时,每个人都会在UIWebViewDelegate
中打开一个pdf。
但是,只有一个有效。
A和B这两个按钮都具有点击功能的格式(除了按钮B会说ButtonB不是ButtonA)
- (IBAction)openPDF_Pictures_A:(id)sender
{
ButtonAPDFViewController *DWV =[[ButtonAPDFViewController alloc] initWithNibName:nil bundle:nil];
self.masterPopOverController = [[UIPopoverController alloc] initWithContentViewController:DWV];
[self.masterPopOverController presentPopoverFromRect:[sender frame] inView:[sender superview] permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[self.masterPopOverController setPopoverContentSize:CGSizeMake(600, 800) animated:NO];
}
在每个UIWebView的UIViewController中,是:
#import "ButtonAViewController.h"
@interface ButtonAViewController ()
@end
@implementation ButtonAViewController
@synthesize buttonAPDFView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"partA" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[buttonAPDFView loadRequest:request];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
按钮A和B都在同一视图上。我确实让其中一个IBActions使用masterPopOverController2和一个masterPopOverController来查看是否会解决任何事情,但它没有。不起作用的那个打开了一个弹出框,但它没有在弹出框中显示PDF。有什么建议吗?
答案 0 :(得分:0)
刚才意识到我没有在xib中的UIView中添加UIWebView ...