I have a class which is derived from window controller with xib which has all the functionalities. In this xib i have a tableview which displays the list of halls. If i double click on a hall name, i ll get a popover, which displays the features of that hall. I have a view controller class, in which i would ilk to create the pop over programatically,
NSPopover *popover;
NSViewController *popoverViewController;
-(void)displayPopover{
popover = [[NSPopover alloc] init];
[popover setBehavior: NSPopoverBehaviorApplicationDefined];
[popover setDelegate: self];
popoverViewController = [[CHBPopover alloc] initWithNibName: @"MYViewController" bundle: nil];
[popover setContentViewController: popoverViewController];
[popover setContentSize: popoverViewController.view.frame.size];
[popover showRelativeToRect: NSMakeRect(700, 400, 5, 5)
ofView: [[NSApp keyWindow] contentView]
preferredEdge: NSMaxXEdge];
}
In my window controller class, i have a method like,
-(IBAction)featuresDisplay:(id)sender{
if([_hallNamesList selectedRow] == -1){
[self setFeaturesList:nil];
}
else {
//[self.hallFeaturesPopOver showRelativeToRect:[_hallNamesList frameOfCellAtColumn:0 row:[_hallNamesList selectedRow]] ofView:_hallNamesList preferredEdge:NSMaxXEdge];
// [pop.displayPopover ];
NSDictionary *hallFeaturesDictionary;
hallFeaturesDictionary = [_hallNames objectAtIndex:[_hallNamesList selectedRow]];
_hallId=[hallFeaturesDictionary valueForKey:@"hallId"];
[officeDetails setHallName:[hallFeaturesDictionary valueForKey:@"hallName"]];
_featuresList=[conferenceHall getConferenceHallFeaturesWithDetails:officeDetails];
NSLog(@"features list=%@",_featuresList);
[self setFeaturesList:[conferenceHall getConferenceHallFeaturesWithDetails:officeDetails]];
}
}
How would i call that popover method in this IBAction? I need to double click on a row and display the pop over.. How would i do this? Thanks.