草庐IT

AnuncioV2ViewController

全部标签

ios - 来自变量的 ViewController Storyboard ID

我如何通过structswift文件中的variable在Storyboard中设置ViewControllerStoryboardID?我不想从IdentityInspector>Identity>StoryboardID硬编码记下VC的StoryboardID。我希望它位于structswift文件中的一个变量中,我可以在其中访问它并从那里设置/更改它。 最佳答案 来自Apple文档。https://developer.apple.com/documentation/uikit/uistoryboard/1616214-inst

ios - 如何在使用 Swift 关闭 ViewController 期间将值从 ViewController B 传递到 ViewController A?

这个问题在这里已经有了答案:Delegatesinswift?(15个答案)关闭3年前。在我的场景中,我试图在关闭ViewController期间将值从ViewControllerB传递到ViewControllerA。这里我使用了下面的代码,但我无法获取ViewControllerA中的值。ViewControllerB//protocolusedforsendingdatabackprotocolisAbleToReceiveData{funcpass(data:String)//data:stringisanexampleparameter}//Makingthisaweakva

ios - 保存 ViewController 的实例

我有一个程序,用户将在一个ViewController中输入数据,然后在另一个ViewController中计算信息。我已经到了可以输入数据的地步,当我转到SecondViewController时,我可以访问我的数据。但是当我切换回第一个ViewController时,UITextFields是空白的,因为ViewController被重新实例化了。到目前为止,基本上我的应用程序有一个带有两个UITextfield的ViewController和一个显示数据的SecondViewController。当我在两者之间切换时,我需要一种方法来保存第一个ViewController的实例。

ios - 选项卡式 IOS 应用程序中 StoryBoard ViewController 的问题

在使用基于MVC的Swift1.2和Xcode6.3开发选项卡式IOS应用程序的过程中,我使用的是可视化Storyboard元素而不是以编程方式进行,因为我不是经验丰富的开发人员。在下面的图片中,您可以在应用程序的StoryBoard中看到架构:该应用程序包括:一个TabBarController和四个TabBarItems。每个Item在Storyboard中都有自己的ViewController。所有这些都与StoryBoard中的关系序列(ViewControllers)链接。StoryBoard中的每个ViewController都有自己的Class。最后一个项目有一个嵌入式N

ios - show segue 后我的 viewcontroller 没有被取消初始化

我创建了两个ViewController,每个ViewController都有一个按钮,可以显示到另一个ViewController。varcounter=0classViewController:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()counter+=1print("initviewc\(counter)")}deinit{counter-=1print("deinitviewc\(counter)")}}似乎从未调用过deinit,每次我返回ViewController时,计数器都在增加:init

ios - 如何使 TabBarController 的 ViewController 上的 UIButton 使用户返回到 Swift 中最后选择的 TabBarViewController(不是当前的)

我有一个5个选项卡的TabBarController,其中selectedIndex=2(第3个TabBarItem)是嵌入在NavigationViewController中的全屏摄像头,通过self.tabBarController?.tabBar.isHidden=true隐藏了选项卡栏和导航栏和self.navigationController?.isNavigationBarHidden=true分别。我在相机预览层上显示了一个UIButton;目前,我正在实现self.tabBarController?.selectedIndex=0以导航回第一个TabBarItem。我需

ios - 从不同 ViewController 中的函数捕获 var | swift

我正在制作一个占星应用程序,在主视图Controller中,您可以单击一系列按钮来拉出一个显示其占星的弹出屏幕。我有一个主要功能buttonLayout()为我的ViewController制作所有按钮并设置它们的图像。单击按钮后,我希望它弹出一个弹出窗口,其中包含他们在主视图Controller中单击的相同按钮我大写的部分是我不知道该怎么做。这是我的ViewController代码://ViewController.swift//Zodiacv2importUIKitclassViewController:UIViewController{@IBOutletweakvarheader

macos - 在扩展信息按钮编辑模式上显示 ViewController

我正在为Yosemite开发TodayExtension。我想显示一个SettingsViewController而不是进入编辑模式。如果我在“widgetDidBeginEditing”上“presentViewControllerInWidget”,它会出现一些奇怪的故障,并且ViewController一直在隐藏和显示。有没有人实现了在点击信息按钮时显示viewController或知道该故障的解决方法?funcwidgetDidBeginEditing(){self.presentViewControllerInWidget(self.settingsViewControlle

ios - 游戏在转到 gameOver Viewcontroller 后重新启动

我的spritekit游戏有问题,它在我使用后立即重新启动一个模型segue到我的gameoverviewcontroller。每次重新启动游戏后,fps也会除以2。所以我实际上需要一种在使用segue后删除游戏的方法。我试过self.dismissViewControllerAnimated(true,completion:nil)但我真的不知道我应该放在哪里。我的Storyboard中有3个ViewController,第一个使用带有模态转场的按钮到第二个我玩游戏场景的按钮。overridefuncviewWillLayoutSubviews(){super.viewWillLay

ios - 是否可以在故​​事板上将自定义 UIImagePickerController 类与 viewController 连接起来

我想让这门课与Storyboard场景联系起来。当前结果是我的StoryboardViewController显示我保存的相册。我想自定义此类以显示相机。有没有办法在这里执行此操作而不必创建UIViewController类并在其中创建和显示UIImagePickerController?原因是我正在使用UIPageController,所以不想调用模态imagepickervc。classCameraViewController:UIImagePickerController{overridefuncviewDidLoad(){super.viewDidLoad()}override