Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update parent controller #11

Closed
miladswift opened this issue Mar 21, 2020 · 9 comments
Closed

update parent controller #11

miladswift opened this issue Mar 21, 2020 · 9 comments

Comments

@miladswift
Copy link

hi sir
i go the lark controller with press a button
and in lark controller i type a text in text field and then i press a button
and i want send my text to parent controller
when i back to parent controller nothings changed
whats my problem ?
here is my code
thanks
`import UIKit
import SPLarkController
class ViewController: UIViewController {

@IBOutlet weak var labelResult: UILabel!
internal var  labelText = ""
@IBAction func goToLarkController(_ sender: Any) {
    
    let vc = storyboard?.instantiateViewController(withIdentifier: "ViewController2")
    let transitionDelegate = SPLarkTransitioningDelegate()
    vc?.transitioningDelegate = transitionDelegate
    vc?.modalPresentationStyle = .custom
    vc?.modalPresentationCapturesStatusBarAppearance = true
    self.present(vc!, animated: true, completion: nil)
}

override func viewDidLoad() {
    super.viewDidLoad()

    labelResult.text = labelText
    
}}`

`import UIKit
import SPLarkController
class ViewController2: UIViewController {

@IBOutlet weak var t: UITextField!
@IBAction func act(_ sender: UIButton) {
    let backToMainController = storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
    backToMainController.labelText = t.text!
    let transitionDelegate = SPLarkTransitioningDelegate()
    backToMainController.transitioningDelegate = transitionDelegate
    dismiss(animated: true, completion: nil)
    SPLarkController.updatePresentingController(modal: backToMainController)
}

override func viewDidLoad() {
    super.viewDidLoad()

}

}`

@ivanvorobei
Copy link
Owner

Please, read this section

@miladswift
Copy link
Author

Please, read this section

thanks for your answer a lot
but i read it
and i dont know what my problem is

@ivanvorobei
Copy link
Owner

Ah sorry, you found this function. Which controller you pass for modal func? settings or root? try change

@miladswift
Copy link
Author

Ah sorry, you found this function. Which controller you pass for modal func? settings or root? try change

first i pass root controller for modal func
now i try both
its not working :(((((
i tried for 9 hours :((
i recall my viewdiLoad (root controller) and i figure out parameters changed
but root view does not changed :((
i dont know what to do
can you check my code ?
i appreciate so much

@ivanvorobei
Copy link
Owner

in modal func you should pass settings controller (bottom)

@miladswift
Copy link
Author

in modal func you should pass settings controller (bottom)

i'm sorry
i'm beginner
how should pass the controller that i already in ?
i don't want border you
but i'm in serious trouble

1
2
3

the label in main controller does't change
that's my problem

@ivanvorobei
Copy link
Owner

@miladswift it not updated even after close controller?

@miladswift
Copy link
Author

@miladswift it not updated even after close controller?

yes
i run it even on my phone
same issue
as you see in viewDidLoad i put a print order that show us the parameter changed ("XXXXXXXX")
but in root controller , text label does't changed
i'm work on it about i don't know maybe 20 hours :|
i even use snapshotViewAfterScreenUpdates func
same issue

@ivanvorobei
Copy link
Owner

Dear friend, problem not with my project. You need found problem in your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants