Re: iOS UINavigation background removal.

2022-01-28 Thread Mike Abdullah via Cocoa-dev
If I remember correctly from doing something like this in the path, the 
important thing in the below code is you are providing a custom image for the 
nav bar to draw as its background, instead of doing a blur effect. The image 
you supply happens to be empty so nothing is drawn in the end, and you get the 
effect you want.

Mike.

P.S. 2 minute builds sound insane though. The entirety of Sketch does 
incremental builds considerably faster than that. Go look at your build log, 
try to figure out what’s swallowing time.

> On 28 Jan 2022, at 21:13, Alex Zavatone via Cocoa-dev 
>  wrote:
> 
> Hi David.  I hate to tell you, your code doesn’t work.
> 
> The old UINavigationBar background that I’m trying to remove is still there 
> when I use your code over what I stumbled across.  
> 
> Something in the code below does remove the background image.
> 
>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)
> 
> Sadly, each build takes 2 minutes (thanks Swift!) even if I’m only changing 1 
> line, so it’s not time effective to figure out exactly what is.
> 
> Fun times.  
> 
> Cheers,
> Alex Zavatone
> 
> 
>> On Jan 28, 2022, at 2:02 PM, David Duncan  wrote:
>> 
>> 
>> 
>>> On Jan 28, 2022, at 11:50 AM, Alex Zavatone >> > wrote:
>>> 
>>> 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]
>>> self.navigationController?.navigationBar.backgroundImage(for: .default)
>>>navigationController?.navigationBar.setBackgroundImage(UIImage(), 
>>> for: .default)
>> 
>> This stuff is pre-iOS 13 appearance customization. Using the new stuff will 
>> disable it.
>> 
>>> 
>>>let navBar = self.navigationController!.navigationBar
>>>let standardAppearance = UINavigationBarAppearance()
>>>standardAppearance.configureWithOpaqueBackground()
>>>standardAppearance.backgroundImage = UIImage()
>>> 
>>>navBar.standardAppearance = standardAppearance
>>>navBar.scrollEdgeAppearance = standardAppearance
>> 
>> With iOS 13 the navigation bar now has multiple appearance states. The 
>> scrollEdgeAppearance is when your bar is at the edge of a scroll view (top 
>> for a navigation bar, bottom for tab & toolbar). This configures the bar to 
>> use the same appearance state (in this case, a solid color background, using 
>> UIColor.systemBackgroundColor). In context the setting of backgroundImage 
>> doesn’t do anything (it defaults to nil and empty images have identical 
>> behavior).
>> 
>> By setting standardAppearance == scrollEdgeAppearance it in turn disables 
>> the “bar becomes transparent at the top” behavior introduced for large 
>> titles in iOS 13 and extended to all bar in iOS 15.
>> 
>>> 
>>> 
>>> Thanks again David.  You’re on my Christmas list.
>>> 
>>> Alex Zavatone
>>> 
 On Jan 28, 2022, at 1:30 PM, David Duncan >>> > 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 
> mailto:cocoa-dev@lists.apple.com>> 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 

Re: iOS UINavigation background removal.

2022-01-28 Thread Alex Zavatone via Cocoa-dev
Hi David.  I hate to tell you, your code doesn’t work.

The old UINavigationBar background that I’m trying to remove is still there 
when I use your code over what I stumbled across.  

Something in the code below does remove the background image.

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)

Sadly, each build takes 2 minutes (thanks Swift!) even if I’m only changing 1 
line, so it’s not time effective to figure out exactly what is.

Fun times.  

Cheers,
Alex Zavatone


> On Jan 28, 2022, at 2:02 PM, David Duncan  wrote:
> 
> 
> 
>> On Jan 28, 2022, at 11:50 AM, Alex Zavatone > > wrote:
>> 
>> 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]
>>  self.navigationController?.navigationBar.backgroundImage(for: .default)
>> navigationController?.navigationBar.setBackgroundImage(UIImage(), 
>> for: .default)
> 
> This stuff is pre-iOS 13 appearance customization. Using the new stuff will 
> disable it.
> 
>> 
>> let navBar = self.navigationController!.navigationBar
>> let standardAppearance = UINavigationBarAppearance()
>> standardAppearance.configureWithOpaqueBackground()
>> standardAppearance.backgroundImage = UIImage()
>> 
>> navBar.standardAppearance = standardAppearance
>> navBar.scrollEdgeAppearance = standardAppearance
> 
> With iOS 13 the navigation bar now has multiple appearance states. The 
> scrollEdgeAppearance is when your bar is at the edge of a scroll view (top 
> for a navigation bar, bottom for tab & toolbar). This configures the bar to 
> use the same appearance state (in this case, a solid color background, using 
> UIColor.systemBackgroundColor). In context the setting of backgroundImage 
> doesn’t do anything (it defaults to nil and empty images have identical 
> behavior).
> 
> By setting standardAppearance == scrollEdgeAppearance it in turn disables the 
> “bar becomes transparent at the top” behavior introduced for large titles in 
> iOS 13 and extended to all bar in iOS 15.
> 
>> 
>> 
>> Thanks again David.  You’re on my Christmas list.
>> 
>> Alex Zavatone
>> 
>>> On Jan 28, 2022, at 1:30 PM, David Duncan >> > 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 
 mailto:cocoa-dev@lists.apple.com>> 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 (Cocoa-dev@lists.apple.com 
 )
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com 
 
 
 This email sent to david.dun...@apple.com 
>>> 

Re: iOS UINavigation background removal.

2022-01-28 Thread David Duncan via Cocoa-dev


> On Jan 28, 2022, at 11:50 AM, Alex Zavatone  wrote:
> 
> 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]
>   self.navigationController?.navigationBar.backgroundImage(for: .default)
> navigationController?.navigationBar.setBackgroundImage(UIImage(), 
> for: .default)

This stuff is pre-iOS 13 appearance customization. Using the new stuff will 
disable it.

> 
> let navBar = self.navigationController!.navigationBar
> let standardAppearance = UINavigationBarAppearance()
> standardAppearance.configureWithOpaqueBackground()
> standardAppearance.backgroundImage = UIImage()
> 
> navBar.standardAppearance = standardAppearance
> navBar.scrollEdgeAppearance = standardAppearance

With iOS 13 the navigation bar now has multiple appearance states. The 
scrollEdgeAppearance is when your bar is at the edge of a scroll view (top for 
a navigation bar, bottom for tab & toolbar). This configures the bar to use the 
same appearance state (in this case, a solid color background, using 
UIColor.systemBackgroundColor). In context the setting of backgroundImage 
doesn’t do anything (it defaults to nil and empty images have identical 
behavior).

By setting standardAppearance == scrollEdgeAppearance it in turn disables the 
“bar becomes transparent at the top” behavior introduced for large titles in 
iOS 13 and extended to all bar in iOS 15.

> 
> 
> Thanks again David.  You’re on my Christmas list.
> 
> Alex Zavatone
> 
>> On Jan 28, 2022, at 1:30 PM, David Duncan > > 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 
>>> mailto:cocoa-dev@lists.apple.com>> 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 (Cocoa-dev@lists.apple.com 
>>> )
>>> 
>>> 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:
>>> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com 
>>> 
>>> 
>>> This email sent to david.dun...@apple.com
>> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS UINavigation background removal.

2022-01-28 Thread Alex Zavatone via Cocoa-dev
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  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 
>>  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 (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
>> 
>> This email sent to david.dun...@apple.com
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS UINavigation background removal.

2022-01-28 Thread David Duncan via Cocoa-dev
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 
>  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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


iOS UINavigation background removal.

2022-01-28 Thread Alex Zavatone via Cocoa-dev
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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com