iOS 将我的视图连接到按下按钮时的弹出窗口

发布于 2024-11-30 17:38:09 字数 316 浏览 1 评论 0原文

我有两个 xib,一个是带有按钮的标题屏幕,另一个是一个更具体的窗口,按下其中一个按钮时应该出现。

这不是切换整个屏幕,只是一个弹出窗口,在该窗口的边界之外单击将使其消失,只留下我的标题屏幕,因为它在该弹出视图后面可见。这和我对“模态视图”的理解类似。

无论如何,我不太明白如何将它连接到标题屏幕上的按钮。我已经在 IB 中提出了意见,准备出发。我不确定我是否已声明所有对象都令人满意。

据我了解,我认为我需要一个 UIViewController 或其他东西,但现在所有的信息都是相当浓重的迷雾,

洞察力值得赞赏,或者指向正确的菜鸟来源的链接会有所帮助

I have two xibs, one is my title screen with buttons, the other is a more specific window that should come up when one of the buttons is pressed.

This isn't switching the whole screen, just a popup window, where clicking outside of the bounds of that window will make it disappear leaving only my title screen remaining as it was visible behind this popup view. This is similar to my understanding of "modal views".

Anyway I do not quite get how to connect it to the button on my title screen. I have the views made in IB ready to go. I'm not sure if I have declared all objects to satisfaction yet.

From what I understand I think I need a UIViewController or something, but its all a pretty thick fog of information right now

insight appreciated, or links to proper noob sources would be helpful

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

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

发布评论

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

评论(1

谁与争疯 2024-12-07 17:38:09

您的标题屏幕是否有视图控制器(或者您的应用程序委托是主控制器对象)?您将需要向该对象添加 IBAction,将按钮连接到它,然后从那里以模态方式(或在弹出窗口中)呈现您的其他视图控制器。

一个带有箭头的小窗口中将出现一个弹出窗口,点击外部将关闭它。模态视图控制器通常会向上滑动到位,您必须按取消按钮才能将其关闭。 本指南介绍了如何使用弹出窗口。如果您有一个视图控制器,那么使用模态视图控制器就很简单:[myViewController PresentModalViewController:nextViewControlleranimated:YES]

Does your title screen have a view controller (or is your app delegate the main controller object)? You will want to add an IBAction to that object, connect the button to it, and then present your other view controller modally (or in a popover) from there.

A popover will appear in a small window with an arrow, and tapping outside will close it. A modal view controller typically slides up into place, and you have to press a cancel button to close it. This guide explains how to use a popover. Using a modal view controller is simple if you have a view controller: [myViewController presentModalViewController:nextViewController animated:YES].

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