UIScrollView/子视图的委托

发布于 2024-09-25 21:25:46 字数 423 浏览 3 评论 0原文

你能帮我为 UIScrollView 设置一个委托,这样我就可以在它的子视图中与它交互吗?

以下问题:

我向 UIScrollView 添加了一些 UIViewController(带有额外的笔尖)。我想从这些子视图中控制 ScrollView。例如,我想在按下按钮时禁用滚动。

在我读到的另一个线程中,这可以使用委托来完成。我根据教程尝试过,但没有机会...控制器结构如下:

BlaViewController
{
-- UIScrollView
---- UIView (View1Controller) --> Including the button which should control the UIScrollView
---- UIView (View2Controller)
}

提前致谢!

can you help me setting up a delegate for a UIScrollView, so I can interact with it from within it's subviews?

Following problem:

I added some UIViewControllers (with extra nibs) to a UIScrollView. I want to control the ScrollView from within those subviews. E.g. I want to disable scrolling when I press a button.

In another thread I read, that this can be done using delegates. I tried that based on a tutorial, but no chance... The controller structure is following:

BlaViewController
{
-- UIScrollView
---- UIView (View1Controller) --> Including the button which should control the UIScrollView
---- UIView (View2Controller)
}

Thanks in advance!

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

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

发布评论

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

评论(1

离笑几人歌 2024-10-02 21:25:46

您猜测使用委托的方式是正确的。我的猜测是你只是没有正确实施它。观看 Stanford iPhone Dev 第 11 场讲座怎么做。

The way you guessed using delegates in correct. My guess is you're just not implementing it correctly. Have a look at Stanford iPhone Dev the 11th lecture to how to do it.

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