将子视图显示为弹出窗口时出现问题
我想在弹出窗口中显示视图的子视图。 详细地说,
我有一个 mainViewController。 我在这个 mainViewController 中有一个子视图“songListView”。 我在 mainViewController 本身中有一个名为“列表”的按钮。 我想在单击“列表”按钮时在弹出窗口中显示歌曲列表视图。
那么,我该怎么做呢。
I want to show the subview of a view in popover.
To elaborate,
I have a mainViewController.
I hava a subview 'songListView' in this mainViewController.
I have a button titled 'list' in the mainViewController' itself.
I want to show the songListView in popover on clicking the button 'list'.
So, how should I do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用下面的代码作为从 UIButton 显示 PopOver 的参考
You could use the below code as a reference for showing PopOver from a UIButton
我的问题解决了。
我刚刚创建了另一个视图控制器类,即“TempPopoverView”。
然后我将此 TempPopoverView 的视图设置为等于我的 MainView 的子视图
这是我的代码中的代码片段:
My problem is solved.
I just created another View Controller class, i.e. 'TempPopoverView'.
Then I set the view of this TempPopoverView equal to the subview of my MainView
Here is the code snippet from my code:
您可以在主视图上使用presentModalViewController。
例如,
也可以有不同的动画。
U can use presentModalViewController on your main view.
For example
There are different animations possible as well.
就像你想象的一样简单,在 self.view 中添加子视图
as simple as you think to add subview in self.view