滚动视图中的弹出窗口

发布于 2024-11-07 04:34:09 字数 709 浏览 0 评论 0原文

在我的 iPad 应用程序中,我在滚动视图中使用带有箭头的弹出框。它工作正常,但是当我滚动视图,然后点击按钮时,带有箭头的弹出窗口不会跟随按钮,它会在其原始位置打开。

我使用这段代码:

(void)showHomePopupAction:(id)sender {     
   self.popHome = [[[PopHome alloc] initWithNibName:@"PopHome" bundle:[NSBundle mainBundle]] autorelease];
   popHome.contentSizeForViewInPopover = CGSizeMake(popHome.view.frame.size.width, popHome.view.frame.size.height);
   self.popoverController = [[[UIPopoverController alloc] initWithContentViewController:popHome] autorelease];
   [self.popoverController presentPopoverFromRect:popoverButtonForHome.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];     
}

您有任何想法或建议来解决这个问题吗? 谢谢!

In my iPad App, I use a popover with an arrow on a button in a scroll view. It works fine but when I scroll the view, then tap on the button, the popover with the arrow doesn't follow the buttom, it opens at its original position.

I use this code:

(void)showHomePopupAction:(id)sender {     
   self.popHome = [[[PopHome alloc] initWithNibName:@"PopHome" bundle:[NSBundle mainBundle]] autorelease];
   popHome.contentSizeForViewInPopover = CGSizeMake(popHome.view.frame.size.width, popHome.view.frame.size.height);
   self.popoverController = [[[UIPopoverController alloc] initWithContentViewController:popHome] autorelease];
   [self.popoverController presentPopoverFromRect:popoverButtonForHome.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];     
}

Do you have any idea or suggestion to fix this problem?
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

(り薆情海 2024-11-14 04:34:10

嘿,尝试这样的事情:

- (void)showHomePopupAction:(id)sender {     
       self.popHome = [[[PopHome alloc] initWithNibName:@"PopHome" bundle:[NSBundle mainBundle]] autorelease];
       popHome.contentSizeForViewInPopover = CGSizeMake(popHome.view.frame.size.width, popHome.view.frame.size.height);
       self.popoverController = [[[UIPopoverController alloc] initWithContentViewController:popHome] autorelease];
       CGRect frame = popoverButtonForHome.frame;
       frame.origin.y -= self.scrollView.bounds.origin.y; // you can postion the popover with + and - values
       [self.popoverController presentPopoverFromRect:frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}

我只需要完全相同的...代码适用于 uiscrollview 中的 uibutton。

Hey, try something like this:

- (void)showHomePopupAction:(id)sender {     
       self.popHome = [[[PopHome alloc] initWithNibName:@"PopHome" bundle:[NSBundle mainBundle]] autorelease];
       popHome.contentSizeForViewInPopover = CGSizeMake(popHome.view.frame.size.width, popHome.view.frame.size.height);
       self.popoverController = [[[UIPopoverController alloc] initWithContentViewController:popHome] autorelease];
       CGRect frame = popoverButtonForHome.frame;
       frame.origin.y -= self.scrollView.bounds.origin.y; // you can postion the popover with + and - values
       [self.popoverController presentPopoverFromRect:frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}

I just needed exactely the same ... the code works for my uibutton in a uiscrollview.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文