theunexpected1
theunexpected1

Reputation: 1035

UINavigationBar should be opaque but a transparent PNG image should allow background to be visible

My Output is as such: As you can see, the gray pixel background in the content area starts after the cutty edges of my navigationbar.

https://i.sstatic.net/eUqqX.png

But my requirement is as follows:

I want the navigation bar to be opaque. But should there be any transparent section in the navigation bar image, then the bottom gray pixel background image should be visible.

https://i.sstatic.net/iHjVg.jpg

What I assume as the solution would be if the background image can be scaled all the way to the top behind the navigationBar section. In that case, if there is a transparency in the navigationBar image, the pixel background would be visible.

Please suggest if anyone has the idea to achieve this.

Upvotes: 0

Views: 579

Answers (1)

theunexpected1
theunexpected1

Reputation: 1035

If anyone is facing a similar situation, the answer is to set the bounds of the view as follows so it moves a little under the UINavigationBar

self.view.bounds = CGRectMake(0.0, 10.0, 320.0, 480.0);

Hence, this displays the background through the UINavigationBar

Upvotes: 1

Related Questions