在 UINavigationBar 和 UIViewController 上覆盖 UIView

发布于 2024-09-14 20:56:47 字数 489 浏览 9 评论 0原文

本质上,我想在 UINavigationController 下方显示一个通知,覆盖最顶部 UIViewController 视图所占据的区域。但是我希望背景图像向上延伸并部分覆盖 UINavigationBar

成品应该如下所示 alt text

诀窍在于我只希望它适用于具有视图层次结构的某些视图,因此通过以下方式解决问题使用 [UIApplication keyWindow] 可能不是最好的主意。另外,我假设通过使用私有 UINavigationTransitionView 之外的视图不会成为视图转换动画的一部分,当弹出该视图时,我的视图将保留在控制器的顶部。

最顶层视图控制器的视图也没有帮助,因为它的框架终止于 UINavigationBar 的底部,这意味着箭头不会与 UINavigationBar 重叠

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

成熟的代价 2024-09-21 20:56:47

因为您似乎面临 Navigation Bar 的问题,因为它不允许重叠视图。

这是棘手的部分......
只需使用自定义后退按钮将图像设置在导航栏按钮左侧的上方

输入图像描述这里

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];

这肯定会对您有所帮助&解决您所有的相同查询....在此处输入图像描述

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文