开发者

Make UIView in the center of the screen

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 o开发者_开发问答f 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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜