-1

I'm performing flip view transition on two views, which are bounded in A Container View. Flippng them first time is working fine. On second time views Frame goes out of view.

like

[<UIView: 0x7fc2316aa030; frame = (-154 -529; 0 0); autoresize = RM+BM; layer = <CALayer: 0x7fc2316aa1a0>>] 

After flipping again, it shows container view.

It's working fine if I Uncheck "Use Autolayout" in my project.

But wWhat to do if I am using AutoLayout???

Here is code:

 @IBAction func flipViews()
{
    if a==false
    {

        UIView.transitionFromView(new, toView: old, duration: 1, options: .TransitionFlipFromLeft, completion: {(isFinished : Bool)
            in

            print(self.view_Effects.subviews)
          // self.old.frame=self.view_Effects.frame

            })
        a=true
    }
    else
    {
        UIView.transitionFromView(old, toView: new, duration: 1, options: .TransitionFlipFromLeft, completion:{(isFinished : Bool)
            in
            print(self.view_Effects.subviews)
            //self.view_Effects.hidden=true
             //self.new.frame=self.view_Effects.frame
        })
        a=false
    }
Pete
  • 57,112
  • 28
  • 117
  • 166

1 Answers1

0

When I layout my views, all start work just fine. When you make a transform, it's important to remember, that autolayout always calculate your views bounds and frame, based on constraints that you set. So, in my case, I just added center vertical and horizontal align, width and height to my rotated view, so the autolayout mechanism knows when exactly my view is. And all goes just fine. Here is a good autolayout tutorial http://www.raywenderlich.com/50319/beginning-auto-layout-tutorial-in-ios-7-part-1

Mahi M.
  • 41
  • 8