一覽
似乎導航欄根本沒有了模糊自iOS7.1 effet。至少我跑了很多測試,通過做新的應用示例,它不再有了。
解決方法使用(在iOS 7.1的工作)
Here a sampleFXBlurView
這不是了不起的,但它工作得很好,它的定製。我的例子當然不是最好的。建議
以前的解決方案(不能在iOS7.1工作)
這裏是我的解決辦法找回來類似的效果。它可以釋放它不使用私人API。但由於它依賴於UINavigationBar
的內部結構,因此iOS的下一次更新可能會有問題。
簡單地做,在你的viewDidLoad
或在任何你想,因爲它的工作原理:
// First we make the background's navigation bar totally translucent
self.navigationController.navigationBar.barTintColor = [UIColor clearColor];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
// Then we create UIToolBar, which are still using blur effect
UIToolbar *tab = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
// We add it the barTintColor we want, works the same as since iOS 7.0.3, don't forget alpha value
tab.barTintColor = [UIColor colorWithRed:0 green:1 blue:0 alpha:0.2];
// And finally we add it to the background view of UINavigationBar... but it can change with future release of iOS. Be aware !
[[self.navigationController.navigationBar.subviews firstObject] addSubview:tab];
我也建議您使用自動版式來約束的UIToolBar
是永遠大小的它的父,對於旋轉等...我沒有這樣做,讓代碼簡潔。
希望它可以幫助你們!
的可能重複[如何鞏固iPhone 5S和5之間的導航欄的透明度?](http://stackoverflow.com/questions/20436450/how-to-consolidating-the-translucency-of-這個導航欄之間的iphone 5s-an) – jervine10
也許你可以顯示這*代碼*你運行? – AncAinu
@AncAinu編輯後使用代碼 –