I'm attempting to alter the Navigation Bar's narrow shadow bar and am using the following code:
if let hairline = findNavigationBarHairline(navigationBar)
{
hairline.bounds.size.height = 5.0
hairline.backgroundColor = UIColor.blueColor()
}
and this:
func findNavigationBarHairline(view:UIView) -> UIImageView?
{
if let hairline = view as? UIImageView where hairline.bounds.size.height <= 1.0
{
return hairline
}
for subview in view.subviews
{
if let imageView = findNavigationBarHairline(subview)
{
return imageView
}
}
return nil
}
This sucessfully finds the UIImageView which is the shadow line but if I try and change anything here it has no effect. Here's a po of the Image View at that point in the code just after its size/color has been set:
(lldb) po hairline
<UIImageView: 0x126d21030; frame = (0 61.75; 320 5); userInteractionEnabled = NO; layer = <CALayer: 0x126d0b470>>
Here it can be seen the height is 5, however it is still displayed with its original size and color. If I use XCode's view hieararchy display and dump the image view from there this is the result:
> Printing description of $124: <UIImageView: 0x126d21030; frame = (0
> 64; 320 0.5); userInteractionEnabled = NO; layer = <CALayer:
> 0x126d0b470>
As can be seen it is the same object, however its height is 0.5 and not 5. Why is the change to the size and color having no effect? (I have also changed the UIImage, but that is not having any effect either).