我正在尝试使用以下代码将旋转器置于页面中央。
然而当我运行程序时,旋转图标似乎不在中心。
有没有什么办法可以解决这个问题呢?
编辑:
我找到了问题。问题并不是旋转图标不在中心,而是子视图与其父视图具有不同的边界。
我在代码中做了类似于这样的事情:
self.aSpinner.center = self.view.center;
然而当我运行程序时,旋转图标似乎不在中心。
![Screen shot of iPad simulator; activity indicator in blank view to right of center](https://istack.dev59.com/3bgD4.webp)
编辑:
我找到了问题。问题并不是旋转图标不在中心,而是子视图与其父视图具有不同的边界。
我在代码中做了类似于这样的事情:
self.navcon = [[UINavigationController alloc]init];
self.photoViewTable = [[PhotoTableViewController alloc]init];
self.loadingPage = [[LoadingPageViewController alloc]init];
[self.photoViewTable.view addSubview:loadingPage.view];
[navcon pushViewController:photoViewTable animated:NO];
[self.window addSubview:navcon.view];
如何将loadingPage
视图的大小设置为与父视图相等?