Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlay a UIView on both a UINavigationBar and a UIViewController

Essentially i want to display a notification just beneath the UINavigationController, covering the area that would be occupied by the top most UIViewController's view. However i want the background image to extend upwards and partly cover the UINavigationBar

The finished product should hopefully look like the below alt text

The trick comes in that i only want this to apply to certain views with the view Hierarchy, so attacking the problem by using [UIApplication keyWindow] might not be the best idea. Also i assume that by using views outside of the private UINavigationTransitionView won't be part of the view transition animation, leaving my view on top of the controller beneath when this one is popped.

The view of the topmost view controller doesn't help either, as it's frame is terminates at the base of UINavigationBar, meaning arrow won't overlap the UINavigationBar

Suggestions?

Thanks

like image 247
Jonathan Avatar asked Nov 15 '22 08:11

Jonathan


1 Answers

Since it seems that you are facing the problem with Navigation Bar only as that will not allow to overlap the View.

This is tricky part.... Just use the Custom back button set the image over it in left of the Navigation bar Button

enter image description here

UINavigationBar *bar = [self.navigationController navigationBar];   
UIButton *btn;
btn = [[UIButton alloc] initWithFrame:CGRectMake(5, 2, 100, 48)];
[btn setImage:[UIImage imageNamed:@"left.png"] forState:UIControlStateNormal];
btn.backgroundColor = [UIColor clearColor];
[bar addSubview:btn];
[btn release];

This is surely going to help you & solve all your Queries for the same ....enter image description here

like image 109
Ajay Sharma Avatar answered Dec 19 '22 11:12

Ajay Sharma