Reputation: 3415
I am trying to move a UIView from one parent view to another and also resize it, right now I am getting that, but animated, how can I do this without animation? videoMover is the view that is getting moved around and sized based on its new parent.
Here is my code that is doing the resize, the parent of the view is changed before this.
CGRect fsRect = CGRectMake(0,0,videoMover.superview.bounds.size.width, videoMover.superview.bounds.size.height);
CGSize presentationSize = CGSizeMake(1280,720);
CGSize viewSize = fsRect.size;
CGFloat scale = fmin(viewSize.width/presentationSize.width, viewSize.height/presentationSize.height);
CGRect videoRect = AVMakeRectWithAspectRatioInsideRect(presentationSize,fsRect);
videoMover.autoresizesSubviews = NO;
videoMover.frame = fsRect;
videoMaster.frame = fsRect;
((CALayer*)[videoMaster.layer.sublayers objectAtIndex:0]).frame = fsRect;
Upvotes: 2
Views: 843
Reputation: 21
Simple , first move your view and set it hidden, and after moving finish, just make your view visible .
[yourView setHidden:YES/NO];
Upvotes: 1
Reputation: 3415
OK, figured it out.. Turns out the animation was occuring as I was setting the frame on my CALayer. I fixed it with this:
[CATransaction begin];
[CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions];
((CALayer*)[videoMaster.layer.sublayers objectAtIndex:0]).frame = fsRect;
[CATransaction commit];
Upvotes: 0