gpt4 book ai didi

ios - 无需导航即可更改 View

转载 作者:行者123 更新时间:2023-11-29 04:44:49 25 4
gpt4 key购买 nike

我有一个 UIViewController,其中有一个 UINavigationController 和一个选项卡栏。

当单击按钮时,我希望 View 发生变化,而不改变 UINavigationControllerTabBarController

我尝试使用ModalViewController,但它隐藏了标签栏和导航栏。

我怎样才能做到这一点?我应该创建一个新的ViewController吗?

另外,如果我希望该 View 仅出现在屏幕的某些部分,我该怎么办?

最佳答案

在同一个类中创建另一个 View ,然后通过编写将其添加到 viewController

[self.view addSubview:newView];

并使其隐藏

newView.hidden = YES;

并在用户点击按钮时显示

newView.hidden = NO;

编辑:让 View 仅出现在屏幕的某些部分。
将 newView 的框架设置为

newView.frame = CGRectMake(10,10,300,50);//do according to your needs

关于ios - 无需导航即可更改 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9803565/

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