I'm making an animated interface in iOS with storyboard. I have a subclass of UIView called AnimatedView with all of the interface elements as its subviews.
I need to be able to change the frame, transform, bounds, alpha etc. of all these subviews. This is turning out to be a problem. When my AnimatedView's layoutSubviews method is called by its parent, it calls some UIView private method called _is_layout, which changes all of my subviews' bound and frame properties back to what they used to be.
If I add the UIViews programmatically this doesn't happen and everything works fine, but I'm working with graphic designers and I don't want them to have to mess with code.
After some trial and error, I've found that removing all the Auto Layout constraints on AnimatedView keeps it from resetting the frames, but it still resets the bounds. Here's what AnimatedView's overridden layoutSubviews method looks like:
-(void)layoutSubviews{
[self createAnimationsFromPlist: filePath];
[self removeConstraints: self.constraints];
[super layoutSubviews];
//set everything to its initial frame
[self.animator animate:0];
}
Am I on the right track by removing the constraints? I've read the auto layout guide and I can't figure out why this would help me. I'm not using constraints in the storyboard with AnimatedView, but self.constraints has 20 elements for some reason.
If it helps, here's an example of how I'm animating the views:
- (void)animateFrame:(NSInteger)time
{
float angle = angleFrames[time];
self.view.transform = CGAffineTransformMakeRotation(angle);
}