Re: iOS UINavigation background removal.
Re: iOS UINavigation background removal.
- Subject: Re: iOS UINavigation background removal.
- From: Alex Zavatone via Cocoa-dev <email@hidden>
- Date: Fri, 28 Jan 2022 13:50:48 -0600
Awesome. Thank you, David.
I stumbled across this too while going through Apple documentation. What’s
scary is that I have no idea why it works.
self.navigationController!.navigationBar.barStyle = .default
self.navigationController!.navigationBar.isTranslucent = false
self.navigationController!.navigationBar.titleTextAttributes =
[.foregroundColor: UIColor.white]
let navBar = self.navigationController!.navigationBar
let standardAppearance = UINavigationBarAppearance()
standardAppearance.configureWithOpaqueBackground()
standardAppearance.backgroundImage = UIImage()
navBar.standardAppearance = standardAppearance
navBar.scrollEdgeAppearance = standardAppearance
self.navigationController?.navigationBar.backgroundImage(for: .default)
navigationController?.navigationBar.setBackgroundImage(UIImage(), for:
.default)
Thanks again David. You’re on my Christmas list.
Alex Zavatone
> On Jan 28, 2022, at 1:30 PM, David Duncan <email@hidden> wrote:
>
> UINavigationBarAppearance *appearance = [UINavigationBarAppearance new];
> [appearance configureWithTransparentBackground];
> navigationItem.standardAppearance = appearance;
>
> Thats the simplest per-item way to do it. This does imply you adopt the new
> appearance APIs introduced in iOS 13.
>
>> On Jan 28, 2022, at 11:03 AM, Alex Zavatone via Cocoa-dev
>> <email@hidden> wrote:
>>
>> Hi there. I’m in the middle of trying to find out how the hell to remove a
>> background from a UINavigationBar and it’s not easy. You’d think that you
>> could get a UInavigationBar.navigationitem.background and remove it from a
>> superview or set its alpha to 0, but it’s not that easy.
>>
>> Does anyone have any clue how to get a reference to the background once it
>> has been set so that it can be set to 0 alpha or removed from the superview?
>>
>>
>> Thanks in advance and happy Friday. Apple sure has ways to make things that
>> should be simple very obscure and extremely deifficult to handle.
>>
>> Cheers,
>> Alex Zavatone
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden