#import <UIKit/UIKit.h>
@interface ViewController : UIViewController<UIPopoverControllerDelegate>
@property (strong, nonatomic) UIButton *Button;
@property (nonatomic, retain) IBOutlet UIPopoverController *poc;
@end
这是我在接口文件
中声明的内容#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.Button=[UIButton buttonWithType:UIButtonTypeCustom];
[_Button addTarget:self
action:@selector(showPop:)
forControlEvents:UIControlEventTouchUpInside];
self.Button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
self.Button.backgroundColor=[UIColor redColor];
[self.view addSubview:self.Button];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)showPop:(UIButton *)button {
UIViewController *detailsViewController =[[UIViewController alloc] init];
self.poc = [[UIPopoverController alloc] initWithContentViewController:detailsViewController];
[self.poc setDelegate:self];
[self.poc presentPopoverFromRect:_Button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
在[self.poc setdelegate:self]
上崩溃了
errorlibc ++ abi.dylib:以NSException类型的未捕获异常终止
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
带有线程SIGABRT的这行代码上的绿色。 我已经在ipad中运行了这个,但仍然有应用程序崩溃同样的错误。 `