草庐IT

ios - 获取 UIStackView subview 的框架

我在IB中创建了一个UIStackView,它的分布设置为FillEqually。我正在寻找每个subview的框架,但下面的代码总是返回(0,0,0,0)。classViewController:UIViewController{@IBOutletweakvarstackView:UIStackView!overridefuncviewDidLoad(){super.viewDidLoad()letpView=UIView()letsView=UIView()pView.backgroundColor=UIColor.redsView.backgroundColor=UIColor.

ios - 无法在 subview Controller 中隐藏选项卡栏

在嵌入UINavigationController的containerView中。该navController2viewControllers已连接。请参见下图。一切正常,除了两个childViewControllers都有一个无论我尝试什么都无法隐藏的TabBar。这是它在设备上的样子。蓝色是containerView的背景色这就是我试图对childViewControllers隐藏的方式self.tabBarController!.tabBar.hidden=trueself.navigationController!.toolbarHidden=trueself.navigati

ios - PageViewController - 将变量传递给 subview

我有什么我有一个ViewController(TutorialViewController)和一个UIPageViewController(TutorialPageViewController)。Storyboard上还有3个额外的View,带有StoryboardID:绿景ControllerBlueViewController红ViewController我一直在关注这个tutorial(感谢作者,写得很好)。在GreenViewController上我定义了一个变量:varpassedVariable=""然后在ViewDidLoad中打印出来。下面是有代码的两个Controll

iOS : UIView with subview Button click event not firing when zPosition of view changes

我在我的应用程序中使用父ViewController和subviewController。其中父ViewController包含subview作为zPosition值为2的按钮。现在,我将subviewController添加到父ViewController,如下所示,funcaddChildViewController(){letstoryboard=UIStoryboard(name:"myStoryBoard",bundle:nil)letchildVC=storyboard.instantiateViewController(withIdentifier:"childVC")a

swift - 转换后 subview 转换调整大小

我有一个容器ViewController和subviewController(类似于UITabViewController)。在一个subviewController的View和另一个subviewController的View之间转换时,我使用:letoldView=//getreferencetooldviewletnewView=//getreferencetonewviewUIView.transition(from:oldView!,to:newView!,duration:0.3,options:.transitionCrossDissolve,completion:nil

ios - UIStackView - 拖动以重新排列排列的 subview ?

我正在尝试就如何实现在UITableView和UIStackView上发现的相同类型的“拖动以重新排序”行为寻求一些建议。到目前为止,这就是我的想法:为每个arrangedSubview添加一个长按手势识别器长按时,添加一个叠加层UIView作为主视图的subview,并填充整个主视图。当我拖动临时的“重新排序”View时,这个叠加View将充当某种“Canvas”——我们将其称为tempView——围绕(更多内容在4中)将arrangedSubview的alpha设置为0(设置hidden=true将导致UIStackView动画关闭就像它被移除一样。将tempView添加到覆盖Vi

ios - 如何在 Google map Xcode 顶部显示 subview 或按钮

我试图在Googlemap上添加一个按钮。我尽我所能,但没有人能帮助我。在Xcode预览中,它显示在顶部,但在运行该应用程序后,它位于谷歌地图下方。PictureafterrunningappHowitlooksinXCODECODEOFMAPimportUIKitimportGoogleMapsclassHomeViewController:UIViewController,CLLocationManagerDelegate{@IBOutletweakvarscrollView:UIScrollView!@IBActionfuncrefreshLocation(sender:AnyO

ios - 使用标签隐藏 subview

我可以快速地给View一个标签letMY_CUSTOM_TAG=123tableView.tag=MY_CUSTOM_TAG我的问题是,如何使用swift从superView中删除带有标签的View?objective-c示例:#defineMY_CUSTOM_TAG1234mySubview.tag=MY_CUSTOM_TAG;[self.tableViewaddSubview:mySubview];//removeviewwithtag[[self.tableViewviewWithTag:MY_CUSTOM_TAG]removeFromSuperview];

swift - 检查 subview 是否存在于 swift 1.2

我已经使用添加了我的subviewself.view.addSubview(noticeSubView)在某些时候,我需要检查该subview是否存在,然后再进行其他一些操作等。我在搜索时发现了以下内容,但不确定它是如何完成的以及如何实现的。BOOLdoesContain=[self.view.subviewscontainsObject:pageShadowView];感谢任何帮助,谢谢。 最佳答案 与其询问您的View中是否存在subview,不如询问subview(在您的例子中是noticeSubView)是否有一个父View

ios - 以编程方式将自定义 UIViewcontroller 添加到 subview 但收到错误消息 "Cannot convert value of type..."

我正在尝试在Swift中以编程方式将自定义UIViewController类(UIPickerView)添加到我的主ViewController(不使用Storyboard)但我收到以下错误消息..."Cannotconvertvalueoftype'HabitViewViewController'toexpectedargumenttype'UIView'自定义UIPicker类:importUIKitclassHabitViewController:UIViewController,UIPickerViewDataSource,UIPickerViewDelegate{@IBOut