gpt4 book ai didi

ios - 如何使用选项卡栏在 View Controller 中显示不同的 View

转载 作者:行者123 更新时间:2023-11-29 03:46:02 24 4
gpt4 key购买 nike

我有一个 View Controller ,它在选项卡栏下有一个 map View 和第二个 View 。当我按下标签栏上的按钮时,如何更新第二个 View ?

我试过:

LocationNotesViewController lnvc = new LocationNotesViewController();
lnvc.View.Frame = MainPageTabBarView.Frame;
MainPageTabBarView = lnvc.View;

什么也没发生... View 不更新。

enter image description here

当用户单击选项卡栏时,我想用不同的内容更新第二个 View ...

最佳答案

如果您将 UIView 置于要在其中显示的任何数据的基础上,则可以使用 tabBar 的 IBAction 以编程方式取出 UIView 的内容。

或者您可以让选项卡栏的 IBActions 动态创建新的 UIView,其中包含您想要的任何内容。

执行此操作的代码如下所示:http://www.programmerscountry.com/creating-uiviewcontrols-programatically/ .

不完全相同,但您将从该答案中了解它是如何工作的。

关于ios - 如何使用选项卡栏在 View Controller 中显示不同的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17753026/

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