我在我的项目中使用 WEPopover。我已经集成了它,它正在显示 PopoverController。我添加为 contentViewController 的类是 UITableViewController 的子类。我在它的 didSelectRowAtIndexPath 上加载另一个视图控制器,但它没有第一次显示这个视图。当我再次点击它时它会出现。我正在添加我的代码。请帮我解决这个问题。
UITouch 上的代码:-
if([[touch view] isKindOfClass:[backGroundImageView class]] && numTaps ==1)
{
CGPoint startLocation = [touch locationInView:backGroundImageView];
startX = startLocation.x;
startY = startLocation.y;
CGRect rect = CGRectMake(startX, startY, 300, 90);
if(self.popoverController)
{
[self.popoverController dismissPopoverAnimated:YES];
self.popoverController = nil;
}
else
{
UIViewController *contentViewController = [[WEPopoverContentViewController alloc] initWithStyle:UITableViewStylePlain];
self.popoverController = [[[popoverClass alloc] initWithContentViewController:contentViewController] autorelease];
if ([self.popoverController respondsToSelector:@selector(setContainerViewProperties:)]) {
[self.popoverController setContainerViewProperties:[self improvedContainerViewProperties]];
}
self.popoverController.delegate = self;
//Uncomment the line below to allow the table view to handle events while the popover is displayed.
//Otherwise the popover is dismissed automatically if a user touches anywhere outside of its view.
self.popoverController.passthroughViews = [NSArray arrayWithObject:backGroundImageView];
NSLog(@"rect1: %@", NSStringFromCGRect(rect));
[self.popoverController presentPopoverFromRect:rect
inView:backGroundImageView
permittedArrowDirections:(UIPopoverArrowDirectionUp|UIPopoverArrowDirectionDown|
UIPopoverArrowDirectionLeft|UIPopoverArrowDirectionRight)
animated:YES];
}