Open darkgravity opened 8 years ago
Create a IBOutlet property with your label in your frontViewController and in prepareForSegue method (in the rearViewController), set the label's properties.
Thank you @iDevelopper , I think this method will reload the viewController. I want the same frontViewController to stay the same and only update the text. I already tried using segue, but it reloads the screen. I should be able to change just the text property without affecting the rest of the elements that I also edited. Is there a way to access fronViewController from the rearViewController without using segue?
Than you! I tried it but it still reload the viewController
here's my code in swift let storyboard = UIStoryboard(name: "Main", bundle: nil) let vc = storyboard.instantiateViewControllerWithIdentifier("ColorEditor") as! ColorEditorViewController vc.color1.oval.fillColor = UIColor.whiteColor().CGColor // This is where I edit a property self.revealViewController().pushFrontViewController(vc, animated: true)
I want everything to stay the same, except for the property that I want to edit.
Have you deleted the segue in your storyboard ? And where did you place this part of code ?
You need to have a property off your controller and instantiate it only if it doesn't exist yet ! Else, use the controller already instantiated... Sorry for my bad english...
Thanks @iDevelopper . I don't think it will work with this approach. What I need really is to make the rearView and the frontViewController without realoading the viewcontroller. Basically what my rearViewContoller is going to be a collection colorpalettes that I can show and hide as I please and these colors would change the color of my objects on the frontViewController. My frontview controller is not just a form but some form of Photo editor/canvas. I wan't my canvas to stay the same and just have one property when I tap on the toolbar nested on the rearviewcontroller.
if (_controller == nil) { instantiate... self.controller = ... } push...
I was able to make it work! What i did is I created a dummy viewcontroller as my default frontViewController. What it does is trigger
self.revealViewController().revealToggle(self)
then I attached this to the viewDidLoad of the rearviewController
let storyboard = UIStoryboard(name: "Main", bundle: nil) vc = storyboard.instantiateViewControllerWithIdentifier("ColorEditor") as? ColorEditorViewController self.revealViewController().pushFrontViewController(vc, animated: true) now I have access to the properties of vc all the time :)
Thanks for the help!!!
You can have a property of this controller in AppDelegate...
Hi,
I followed this tutorial (https://www.youtube.com/watch?v=EWDNScxZ0YU) and I was able to make it work. However, I want to control for example the color of UILabel from the rearViewController. For example I tap on a list view item on the left that says "red", how do I make the UILabel on the frontViewController to red?
Thanks in Advance
-Pat