I need to add a simple loading animation on top a my view..and want it to be in the center of screen(visible aria)..can anybody point me to the right direction.? how to get the center of the window so that i can addSubview..?
Check center property of UIView. You can set your view center to viewControllers root view for example:
yourView.center = self.view.center;
If you may want to control the center alignment of axis's separately, consider the below answer.
Center/align along the X axis
yourView.center = CGPointMake(self.view.center.x,self.yourView.center.y);
Center/align along the Y Axis
yourView.center = CGPointMake(self.yourView.center.x, self.view.center.y);
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