gpt4 book ai didi

ios - 如何在 subview 上突然显示父 View TableView ?

转载 作者:行者123 更新时间:2023-11-29 01:15:03 26 4
gpt4 key购买 nike

这是我的窗口层次结构

->Root view Controller
->tableview
-> child view controller 1

->child view controller 2

图像规范: enter image description here

enter image description here

第一张图片 **Rootview** controller ,第二张图片是 subview controller 放置的,因为 subview 是我的 root View Controller 已被隐藏,我如何才能将 **tableview** 设置为 super View 。

在 Root View Controller 中,我有 **tableview** 当用户单击导航栏按钮时,我需要在上面的两个 subview controller 上显示它是否可能?

这是我在 RootViewController 上呈现的代码

- (IBAction)tableviewapicall:(id)sender
{
if(tableviewbool)
{
_tableview.hidden=NO;
tableviewbool=NO;
[_tableview superview];
}
else
{
_tableview.hidden=YES;
tableviewbool=YES;
}
}

请帮我做那个 friend :)

最佳答案

要实现这一点,只需尝试以下步骤:

首先给两个 subview Controller View 都打上标签。

假设你在 Storyboard 或 xib 中有 subview Controller ,而不是仅仅给它一个唯一的标签。

如果您以编程方式创建了 subview Controller ,而不是在那里以编程方式分配标签。

现在只需这样做:

- (IBAction)tableviewapicall:(id)sender {
if(tableviewbool) {
_tableview.hidden=NO;
tableviewbool=NO;
[_tableview superview];
// Get both Child view controller view by tag Hide it
} else {
_tableview.hidden=YES;
tableviewbool=YES;
// Get both Child view controller view by tag Show it
}
}

希望对你有所帮助。

关于ios - 如何在 subview 上突然显示父 View TableView ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35284954/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com