jjzjj

tabBarController

全部标签

swift - 如何在 swift 3.0 中从一个 tabBarController subview 移动到另一个 Tabbar Controller

我有一个tabBarController,它在选项卡3上有三个选项卡,我有一个ViewController,它有更多的child。但是从UITabBarController索引3的子ViewController我想移动到UITabBarController索引1如何做到这一点请解释一下。 最佳答案 只需为uitabbarviewcontroller设置所需的selectedindex。喜欢tabBarController?.selectedIndex=0 关于swift-如何在swift

ios - 如何重置 Root View Controller

是否可以重置RootViewController?重置是指将其重置为初始状态,以便再次调用viewDidLoad。我正在使用UITabBarController,当我注销时,我希望卸载之前加载的所有选项卡。 最佳答案 您可以通过在注销操作时将TabBarController的实例设置为rootViewController来做到这一点。swift3:letstoryBoard=UIStoryboard(name:"Main",bundle:nil)lettabBarController=storyBoard.instantiateVi

swift - 不明白为什么swift要我说清楚

我正在测试swift并且不明白为什么以下几行不起作用。lettabBarController=UITabBarController()tabBarController.viewControllers=[MyViewController1(),MyTableViewController2()]tabBarController.tabBar.items[0].title="First"tabBarController.tabBar.items[1].title="Second"编译器告诉我:Couldnotfindmember'title'如果我将参数分成多个变量,那么它就可以工作。let

ios - 带有 UIAlertAction swift 的增量标签栏角标(Badge)?

@IBActionfuncaddToCart(sender:AnyObject){letitemObjectTitle=itemObject.valueForKey("itemDescription")as!StringletalertController=UIAlertController(title:"Add\(itemObjectTitle)tocart?",message:"",preferredStyle:.Alert)letyesAction=UIAlertAction(title:"Yes",style:UIAlertActionStyle.Default){(actio

ios - 检测点击 UITabBarController 中的选项卡

我已经像下面这样以编程方式创建了一个tabBarControllerlettabbarController=UITabBarController()lethomeViewController=HomeViewController()letrewardsViewController=RewardsViewController()letmoreViewController=NewMoreViewController()lethomeNVc=UINavigationController()homeNVc.viewControllers=[homeViewController]letrewar

ios - Swift UITabBarController 隐藏动画

我试图在隐藏时向我的tabBarController添加动画。通过使用self.navigationController?.isNavigationBarHidden=true,我能够通过navigationBarController实现此效果。我可以通过使用self.tabBarController?.tabBar.isHidden=true隐藏tabBar,但是我没有得到动画,我该怎么做,提前谢谢你。 最佳答案 我为UIViewController开发了一个util扩展Swift4兼容:extensionUIViewContro

ios - 自定义 moreNavigationController 的 tableview 和类似的用户界面

我已经重写了moreNavigationControllertableview,但我想使用与nativemoreNavigationController的tableview数据源(tabbaritem图标、名称和角标(Badge)等)默认相同的行.我试图从现有数据源中获取单元格。下面是我的代码片段:functabBarController(tabBarController:UITabBarController,shouldSelectViewControllerviewController:UIViewController)->Bool{if(viewController==tabBa

ios - 如何在没有链接到 View Controller 的情况下快速创建标签栏项目

所以我的问题是我正在创建一个没有Storyboard的UITabBarController,并且我对如何创建一个没有Viewcontroller的UITabBar项目感到困惑。因为我想要做的是我的UITabBarItem的第二项是一个不呈现ViewController的Action。 最佳答案 虽然我使用Storyboard,但我在应用程序(关闭按钮)中实现了类似的功能。关闭按钮是一个viewController,但我使用以下代码让它像普通按钮一样工作:functabBarController(_tabBarController:U

ios - tabBarController?.selectedIndex 不切换 VC 的

我在容器View中嵌入了一个TabBarController。第一个选项卡有一个CollectionView和我调用的didselectitematindextabBarController?.selectedIndex=1它成功切换到另一个ViewController。然而,当我调用tabBarController?.selectedIndex=0它不会切换到索引0。实际上它什么都不做。我试过在selectedIndex2上放置一个按钮并从那里调用该命令,但它不起作用。我试过添加self。接电话但不起作用。我试过调用一个进行调用的函数,但它也不起作用。我还确保我的tabBarCont

ios - 在 ViewController 和 TabBarController 之间传递数据

我有几个问题。如何将数据(我在Alamofire请求完成后获得)传递给TabBarController的子项之一?我遇到的第一个问题是我无法覆盖登录操作中的funcprepareForSegue(点击按钮时),它说我只能覆盖类成员。但是,如果我将函数放在IBAction之外,那么我将不会发送我需要的数据。第二个问题是,当我将覆盖函数放在IBAction之外时,代码如下所示:overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject!){lethomeVC=segue.destinationViewContro