I want to create my own custom segue animation in which I want to make presenting VC appear from the button.origin at size(1,1) and shift to CGPoint(0,0) and stretch to full screen size.
VC1
segues to VC2
and passes VC1
's button.frame via
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let PVC = segue.destinationViewController as VC2
PVC.CGstart = button.frame.origin}
in VC2
I have
@IBOutlet var VC4: UIView!
var CGstart = CGPoint()
override func viewDidLoad() {
super.viewDidLoad()
VC4.frame.origin = CGstart
}
@IBAction func DragTest(sender: UIButton) {
VC4.frame.origin = CGstart
println(CGstart)
}
the viewDidLoad
does not adjust VC4
's frame.origin....while my @IBAction func DragTest
does
Why is this? I've tried so many different variations.
This solved the issue.
override func viewDidLoad() {
super.viewDidLoad()
self.view.layoutIfNeeded()
VC4.frame.origin = CGstart
}
no need for viewDidAppear
or layoutSubviews
.