Friday, 6 September 2013

UIPopOver from infoButton on UItableViewCell

UIPopOver from infoButton on UItableViewCell

Hi i am trying to show a popover from info button click which is on a
uitablecell. But when i run it the simulator just hangs up. Following is
my code
This is in 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];
My doHelp Method
-(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)];
}
Any hep will be greatly appreciated.

No comments:

Post a Comment