我正在開發Objective-C中的應用程序,並在該應用程序中將導航欄設置爲半透明(通過IB)。但問題是導航欄後面顯示的視圖。將導航欄設置爲「黑色半透明」樣式時的問題
其他人試過使用半透明導航欄嗎?
問候
賈雅拉傑
我正在開發Objective-C中的應用程序,並在該應用程序中將導航欄設置爲半透明(通過IB)。但問題是導航欄後面顯示的視圖。將導航欄設置爲「黑色半透明」樣式時的問題
其他人試過使用半透明導航欄嗎?
問候
賈雅拉傑
的〔navigationController視圖]自動調整「欠重疊」半透明導航欄作爲OS 3.0
的可以簡單地添加44個像素到原點屬性的y值克服這一點。
您可以使用44如果你知道你的肖像是(不景觀,其中導航欄的高度小於44)
你也可以這樣做:
// applicationFrame subtracts the height of the statusBar if it's visible.
// bounds doesn't take into account the statusBar.
CGRect navFrame = [[UIScreen mainScreen] applicationFrame];
NSLog(@"navFrame: %f x %f", navFrame.size.width, navFrame.size.height);
navFrame.size.height -= self.navigationController.navigationBar.frame.size.height;
NSLog(@"navFrame: %f x %f", navFrame.size.width, navFrame.size.height);
UIImageView *imageView = [[UIImageView alloc] initWithFrame:navFrame];
NSLog(@"imageView: %@", imageView);
我學會了這從閱讀three20的源代碼。你可以在github.com找到它
Matt