好吧,被告知這是可能的,我嘗試在主視圖頂部放置一個視圖,並將其y座標設置爲-20。然後我西到Info.plist並將Status bar style
設置爲Transparent black style (alpha of 0.5)
。我放置的視圖在狀態欄下方可見。
![enter image description here](https://i.stack.imgur.com/gwaUr.png)
這只是發生在運行時;在Interface Buider中,模擬半透明狀態欄是灰色但不透明的。
編輯:如果您想將視圖控制器的主視圖移動到此空間中,則有可能在viewWillAppear
期間。 (如果您嘗試在viewDidLoad
移動它,它就會被後來搬回。)
- (void)viewWillAppear:(BOOL)animated;
{
[super viewWillAppear:animated];
// Move the main view upwards if it isn't already there.
CGRect frame = [[self view] frame];
frame.size.height += frame.origin.y;
frame.origin.y = 0;
[[self view] setFrame:frame];
}
然而,它就會被移到旋轉後回來,我試圖以旋轉響應結束打破了小區的佈局,如果我這樣做到UITableView
。
這是Swift版本。似乎工作。對於採取這些應用商店屏幕截圖(以及除了使Info.plist中的變化很好地解決
覆蓋FUNC viewWillAppear中(動畫:BOOL){
super.viewWillAppear(animated)
// Move the main view upwards if it isn't already there.
var frame: CGRect = self.view.frame
frame.size.height += frame.origin.y
frame.origin.y = 0
self.view.frame = frame
}
您的意思是您想要(1)將狀態欄下的視圖置於狀態欄之下,或者(2)使狀態欄消失並使用您的應用填充屏幕的480像素高度?我認爲(1)是不可能的,儘管「半透明」意味着它對於某些東西來說是半透明的。 – Dondragmer 2012-04-10 09:35:04
這是第一個選項......而且有可能,我的朋友已經幫助我完成了工作。等待他在這裏發佈他的解決方案給他信貸。 – 2012-04-10 11:26:33