childviewcontroller

In iOS, using storyboard, how to setup a view controller inside a container view?

冷暖自知 提交于 2019-12-03 17:01:02
问题 I have created and drawn out a custom UIViewController called AutocompleteVC in my Main storyboard. AutocompleteVC will be used in several different places/storyboards and with different dimensions. For example, in my Transit storyboard, shown below,, there is a custom UIViewController called TransitVC, shown on the left. In TransitVC, I have a container view with an IBOutlet called autocompleteContainerView. autocompleteContainerView has a segue called autocompleteEmbedSegue to a generic

iOS routing viewDidAppear to child view controllers?

这一生的挚爱 提交于 2019-12-03 12:20:26
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. Does anyone know how I can wire this up so that when I do addChildViewController and

In iOS, using storyboard, how to setup a view controller inside a container view?

主宰稳场 提交于 2019-12-03 06:00:07
I have created and drawn out a custom UIViewController called AutocompleteVC in my Main storyboard. AutocompleteVC will be used in several different places/storyboards and with different dimensions. For example, in my Transit storyboard, shown below,, there is a custom UIViewController called TransitVC, shown on the left. In TransitVC, I have a container view with an IBOutlet called autocompleteContainerView. autocompleteContainerView has a segue called autocompleteEmbedSegue to a generic UIViewController, shown on the right in red. The goal is to have TransitVC hold AutocompleteVC inside

Add child view controller to UINavigationController

若如初见. 提交于 2019-12-03 04:22:35
问题 I'm trying to add a child view controller to a UIViewController contained in a UINavigationController with this code: - (void)buttonTapped:(id)sender { MyChildController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MyChild"]; [self addChildViewController:viewController]; [self.view addSubview:viewController.view]; [viewController didMoveToParentViewController:self]; viewController.view.alpha = 0.0f; [UIView animateWithDuration:0.4 animations:^{ viewController

Add child view controller to UINavigationController

允我心安 提交于 2019-12-02 17:46:29
I'm trying to add a child view controller to a UIViewController contained in a UINavigationController with this code: - (void)buttonTapped:(id)sender { MyChildController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MyChild"]; [self addChildViewController:viewController]; [self.view addSubview:viewController.view]; [viewController didMoveToParentViewController:self]; viewController.view.alpha = 0.0f; [UIView animateWithDuration:0.4 animations:^{ viewController.view.alpha = 1.0f; }]; } But this is the result: As you can see the UINavigatioBar and the UIToolbar are

How to transfer data between Parent and Child View Controllers

主宰稳场 提交于 2019-12-02 10:54:29
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(withIdentifier: "People")) addChildViewController(controller!) controller?.view.frame = CGRect(x: 10, y: 200

UINavigationBar with UISegmentedControl partially covers childViews

强颜欢笑 提交于 2019-12-01 01:09:40
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 fine. The thing that goes wrong is that only the first UITableViewController is shown correctly. For

How to pass data from child to parent view controller? in swift

和自甴很熟 提交于 2019-12-01 00:12:09
I created an activity where when one of the text fields clicked it will pop up a child(alert dialog) with list of product but when i click one item on the list I can't display it on the text filed once the alert dismissed. this is the parent view import Foundation import UIKit class ViewAward: UIViewController{ @IBOutlet var tfMCN: UITextField! @IBOutlet var tfAmount: UITextField! @IBOutlet var tfProduct: UITextField! @IBOutlet var tfTotal: UITextField! override func viewDidLoad() { super.viewDidLoad() let rightAddBarButtonItem:UIBarButtonItem = UIBarButtonItem(title: "Send", style:

How to pass data from child to parent view controller? in swift

心已入冬 提交于 2019-11-30 18:47:10
问题 I created an activity where when one of the text fields clicked it will pop up a child(alert dialog) with list of product but when i click one item on the list I can't display it on the text filed once the alert dismissed. this is the parent view import Foundation import UIKit class ViewAward: UIViewController{ @IBOutlet var tfMCN: UITextField! @IBOutlet var tfAmount: UITextField! @IBOutlet var tfProduct: UITextField! @IBOutlet var tfTotal: UITextField! override func viewDidLoad() { super

Container View Controllers - notify parent of action

删除回忆录丶 提交于 2019-11-30 02:26:14
Say I have a custom container view controller (MainViewController) where I do something like this: - (void)viewDidLoad { [super viewDidLoad]; HomeViewController *homeVC = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil]; [self addChildViewController:homeVC]; [self.view addSubview:homeVC.view]; } The HomeViewController will have a button, such as "go", that when pressed will need to advance to the next view controller. So I need to notify the MainViewController of this action. What is the best way to do this? I'm using a custom container because I need to do custom