I am trying to do something pretty basic here. I am using a block-based UIView animation to bring the subview that is currently off the screen to the current view's center. Obviously the sp.view.frame = self.view.center
line is the issue here. In the end, how do I do what I want?
[UIView animateWithDuration:1 delay:0
options:UIViewAnimationOptionCurveLinear
animations:^{
sp.view.frame = self.view.center;
}
Thanks!
It is possible to add a macro like this#define countmid(X,Y) (float) (X-Y)/2
and then use it in code asfloat Center = countmid(VIEW.frame.size.width,SUB.frame.size.width);
to place your SUB view at horizontal center of VIEW
The same for Vertical center, just use height against width
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With