当用户点击屏幕时,我正在尝试隐藏statusBar和navigationBar。 这很好但是当navigationBar和statusBar出现并从屏幕消失时,它总是调整“视图”的大小。因此我虽然setWantsFullScreenLayout:YES不起作用。 这是代码的摘录:
- (void)loadView
{
// Make transparencies of bars and full screen
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
[self setWantsFullScreenLayout:YES];
pagingScrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
/* ... */
// Assign to UIScrollView !!
self.view = pagingScrollView;
}
但是,如果我将self.view分配给UIView而不是UIScrollView,那么当navigationBar和statusBar出现并从屏幕消失时,从未调整视图的大小
- (void)loadView
{
// Make transparencies of bars and full screen
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
[self setWantsFullScreenLayout:YES];
pagingScrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
/* ... */
// Assign to UIView !!
UIView * mainView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[mainView addSubview:pagingScrollView];
self.view = mainView;
}
所以我的问题是¿这里有一些逻辑可以调整视图吗?
提前致谢。