您好我正在尝试显示来自信息按钮点击的popover,它位于uitablecell上。但是当我运行它时,模拟器就会挂断。以下是我的代码
这是在cellForRowAtIndexPath
中 UIButton *helpButton = [UIButton buttonWithType:UIButtonTypeInfoDark ] ;
helpButton.frame = CGRectMake(200, 16, 200 ,15);
helpButton.tag = 458;
[helpButton addTarget:self action:@selector(doHelp:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubview:helpButton];
我的doHelp方法
-(void)doHelp : (id)sender{
testviewcontroller=[[UIViewController alloc]init];
popTable = [[UITableView alloc]initWithFrame:CGRectMake(10, 40, 80, 120) style:UITableViewStyleGrouped];
popTable.delegate = self;
popTable.dataSource = self;
testviewcontroller.view=popTable;
navController = [[UINavigationController alloc] initWithRootViewController:testviewcontroller];
pop=[[UIPopoverController alloc]initWithContentViewController:navController];
// navController.navigationBar.topItem.rightBarButtonItem=searchItem;
// navController1.navigationBar.topItem.title=@"Reporting Type";
navController.navigationBarHidden=true;
[pop presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
[pop setPopoverContentSize:CGSizeMake(250,107)];
}
任何肝脏将非常感激。