parentviewcontroller


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

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

superview and parentviewcontroller nil after adding a subview

限于喜欢 提交于 2019-12-07 07:38:31
问题 I think I'm missing something fundamental and so I want to ask the community for some help. I'm building an app based around a basic iPhone Utility Application. My MainView and FlipsideView share some elements so I have created separate ViewControllers and nib files for those pieces. In order to do this I have done the following: 1. Created a viewcontroller called searchDateViewController which is the file's owner of searchDateView.xib 2. searchDateView.xib is basically a UIView with a

UIViewController parentViewController access properties

无人久伴 提交于 2019-12-05 04:17:11
问题 I know this question has been asked several times and I did read existing posts on this topic but I still need help. I have 2 UIViewControllers - parent and child. I display the child UIViewController using the presentModalViewController as below: ChildController *child = [[ChildController alloc] initWithNibName:@"ChildView" bundle:nil]; [self presentModalViewController:child animated:YES]; [child release]; The child view has a UIPickerView . When user selects an item from UIPickerView and

How to set parentViewController in UIViewController?

廉价感情. 提交于 2019-12-04 17:52:03
问题 The parentViewController property of UIViewController is readonly, but I am nesting custom view controllers and would like to use this property. However, since it is readonly, and I found no other way to set this property, my quesion is: how do I set it? Obviously, UINavigationController can set the property somehow in -pushViewController, and so can -presentModalViewController, so it must be possible. I am aware that I can just add my own UIViewController property, but I'm sure that

UIViewController parentViewController access properties

孤街醉人 提交于 2019-12-03 20:39:29
I know this question has been asked several times and I did read existing posts on this topic but I still need help. I have 2 UIViewControllers - parent and child. I display the child UIViewController using the presentModalViewController as below: ChildController *child = [[ChildController alloc] initWithNibName:@"ChildView" bundle:nil]; [self presentModalViewController:child animated:YES]; [child release]; The child view has a UIPickerView . When user selects an item from UIPickerView and clicks done, I have to dismiss the modal view and display the selected item on a UITextField in the

How to set parentViewController in UIViewController?

匆匆过客 提交于 2019-12-03 10:45:54
The parentViewController property of UIViewController is readonly, but I am nesting custom view controllers and would like to use this property. However, since it is readonly, and I found no other way to set this property, my quesion is: how do I set it? Obviously, UINavigationController can set the property somehow in -pushViewController, and so can -presentModalViewController, so it must be possible. I am aware that I can just add my own UIViewController property, but I'm sure that parentViewController is, in principle, the correct property. However, since it is readonly, and I found no

工具导航Map