childviewcontroller

Resize subview when superview finishes loading

别说谁变了你拦得住时间么 提交于 2021-02-17 07:12:31
问题 I know theres countless similar questions on this that either all result in using flexible height/width or setting translatesAutoresizingMaskIntoConstraints to false. I have add a view using an extension I created: extension UIView { func addView(storyboard: String, viewIdentier: String) { let story = UIStoryboard(name: storyboard, bundle: nil) let subview = story.instantiateViewController(withIdentifier: viewIdentifier) subview.view.frame = self.bounds self.addSubview(subview.view) } } If I

UINavigationBar with UISegmentedControl partially covers childViews

心已入冬 提交于 2020-01-21 05:55:06
问题 I have read many other threads on this and the Apple docs, but haven't found a solution yet for my particular problem. My app uses a UITabBarController as the rootViewController , and in one of the tabs I have a UISegmentedControl in the navigationBar to switch between three child UITableViewController s. (In the real app two of the childVCs are a custom UIViewController , I'm just using three UITableViewController s for the sample app). The segmentedControl setup and the switching all works

iOS - How to set imageview of a parent view controller through child container?

爷,独闯天下 提交于 2020-01-17 05:52:07
问题 I am currently using a container view and I want to change the value of parent view controller imageView through child view controller using delegates, but it always returns nil . import UIKit protocol updateImage { func userIsDone(image:UIImage) } class ViewController: UIViewController, updateImage{ @IBOutlet weak var imageView:UIImageView! var image = UIImage(named: "hello.png") override func viewDidLoad() { super.viewDidLoad() self.imageView.image=self.image } func userIsDone(image:

Add a child view controller's view to a subview of the parent view controller

随声附和 提交于 2020-01-09 04:39:07
问题 I want to add a tableViewController as a child view controller of a containerViewController (shown below). According to Apple's View Controller Programming Guide I can achieve this by the following lines of code inside my containerViewController: [self addChildViewController:tableViewController]; [self.view addSubview:tableViewController.view]; [tableViewController didMoveToParentViewController:self]; In fact, that works fine. Now the problem is that I do not want to add the

How to transfer data between Parent and Child View Controllers

走远了吗. 提交于 2019-12-31 07:07:22
问题 I have tried looking at answers on similar questions to this, but I am not particularly experienced and have had trouble following them, so any help would be much appreciated! My situation is as follows: when I press a button in my Parent ViewController, the following code is used to call a Child ViewController (by the way, the Child is actually a TableViewController, but it seems to work fine "thinking" it's a normal ViewController?): controller = (storyboard?.instantiateViewController

dimiss modal and return to presented childViewController in containerView

此生再无相见时 提交于 2019-12-25 14:48:55
问题 I am having a bit of an issue with dismissing a modal view presented from a childviewController in a container view. I have a UINavigationController as the rootViewController (MainNavigationController), and present a modal from one of the childViewControllers from the selectedSegmentIndex 1 (secondViewController). The modal is presented fine, but when I dismiss the modal to go back to the secondViewController(a subclass of HomeController) it returns me back to selectedIndex 0, so not the

How to remove SFSafariViewController as a child view controller correctly?

谁说胖子不能爱 提交于 2019-12-23 07:11:12
问题 I am using the technique provided by this SO answer to preload some URL in SFSafariViewController like this: addChildViewController(svc) svc.didMoveToParentViewController(self) view.addSubview(svc.view) And I try to remove the Safari View controller with following code: svc.willMoveToParentViewController(nil) svc.view.removeFromSuperview() svc.removeFromParentViewController() Now I can preload the URL and show the Safari View without problem. However, after I repeat the process (preload/show

delegation and passing data back from childViewController

 ̄綄美尐妖づ 提交于 2019-12-12 06:55:08
问题 I have been struggling with this for a few days and have received valuable help on the way from S.O. I have made the simplest possible project to reduce the possibilities of it being a typo. All my project is, is a ViewController that holds a container view hooked to a childViewController. The "parent" ViewController is set as the delegate of the childViewController. In the viewDidLoad of the child I am passing a value which is just a string. This string should be passed on to the parent and

Shall I really use addChildViewController when I add a view to another view (and both these views are controlled by view controllers)?

半世苍凉 提交于 2019-12-11 03:34:21
问题 I am building a UIViewController with a XIB. In this XIB, I have placeholders ( UIView objects in the XIB) in which I place other views, from other view controllers . (By the way, I could also add these views directly, without placeholders) I am not buiding a container view controller: I mean it's not a UINavigationController . It's a just a "usual" view controller. Imagine for example that I have a small subview in my view for a "Facebook" logo and a counter. This "facebook view" is attached

iOS routing viewDidAppear to child view controllers?

岁酱吖の 提交于 2019-12-04 19:07:45
问题 I'm adding a child view controller to a parent view controller, and everything works as expected, except that child view controller isn't having its usual callbacks triggered. eg, things like viewWillAppear(animated) is never called. I looked into it and thought it may be because I wasn't calling willMoveToParentViewController and didMoveToParentViewController on the child view controller before and after adding it to the parent, respectively. Unfortunately, fixing that has made no difference