1

I use Two view's on same ViewController and use two animation 1. Flip Back Animation 2. Background Horizontal image animation (image view is sliding from right to left on view1).Now, when i flip from view1 to view2 everything is correct But when i flip back from view2 to view1 than (slide image view animation stop to slide and become static on view1). I need to refresh the view1 as it work properly . I used these two suggested method by Ved View1.setNeedsDisplay() View1.setNeedsLayout() But it's also not work . Please share info

enter image description here

  • sorry sahil there is nothing important to share i just calling a method two times . Actually i used flip back animation when i return form second view to first view than all the data of first view become static , i use an horizontal animation image view which stop on flip back. –  Sep 02 '17 at 11:00

3 Answers3

2

Write all the code in viewWillappear() . This will solve your issue.

Deep
  • 416
  • 6
  • 15
1

Must put func in viewWillAppear

override func viewWillAppear(_ animated: Bool) {
    func run() { //Here Code Run }
}
-1

You can use a view to refresh by calling

yourView.setNeedsDisplay() //Updates any drawing, including drawRect()

and

yourView.setNeedsLayout() //Triggers layoutSubviews()
Ved Rauniyar
  • 1,539
  • 14
  • 21
  • Ved Thanks for Your Comment But its not working The view remain static , its not moving –  Sep 02 '17 at 10:18