【发布时间】:2017-03-17 12:00:47
【问题描述】:
我无法将活动指示器相对于高度居中。在我添加导航控制器之前很好,之后它水平居中但不是垂直居中。这是照片和代码。
这是在没有导航控制器时居中的代码。
_loadingView.center = self.view.center;
[self.view addSubview:_loadingView];
请帮忙。谢谢!!
【问题讨论】:
-
尝试进入 -(void)viewWillAppear:(BOOL)animated
_loadingView.center = CGPointMake(self.view.frame.size.width / 2.0, (self.view.frame.size.height - navigationBarHeight - tabBarHeight) / 2.0); -
试试这个 CGFloat navigationBarHeight = self.navigationController.navigationBar.frame.size.height; CGFloat tabBarHeight = self.tabBarController.tabBar.frame.size.height; _loadingView.center = CGPointMake([UIScreen mainScreen].bounds.size.width / 2.0, ([UIScreen mainScreen].bounds.size.height - navigationBarHeight - tabBarHeight) / 2.0)
-
不。没用。和以前一样。
-
都试过了。还是和以前一样。
标签: ios objective-c iphone uiactivityindicatorview