自定义UIView覆盖iPhone上的UITabBar而不是iPad [英] Custom UIView covering UITabBar on iPhone but not iPad

查看:160
本文介绍了自定义UIView覆盖iPhone上的UITabBar而不是iPad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个覆盖窗口的自定义uiView。它有点像导航控制器中的诱饵uiview。所以我必须以这种方式来覆盖导航栏....长篇故事......

I'm creating a custom uiView that covers the window. It acts kinda like a decoy uiview in a navigation controller. So I had to do it this way to cover the navigation bar.... long story...

以下是设置方式。

self.searchPopDown.frame = CGRectMake(0, 20, self.navigationController.view.frame.size.width, self.navigationController.view.frame.size.height-20);

    self.searchPopDown.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

20是为了补偿状态栏。

The 20 is to compensate for the status bar.

然后我只是将视图作为子视图添加到应用程序窗口。

Then I simply add the view as a subview to the app window.

//this will add the view ontop of a modalViewController and support rotation!
UIWindow* window = [UIApplication sharedApplication].keyWindow;
if (!window) {
    window = [[UIApplication sharedApplication].windows objectAtIndex:0];
}

if ([[[window subviews] objectAtIndex:0] isKindOfClass:[SVProgressHUD class]]){
    //There is a chance that the window will be the SVProgressHUD in this case we need to get the main window.

    window = [[UIApplication sharedApplication].windows objectAtIndex:0];
}
    [[[window subviews] objectAtIndex:0] addSubview:self.searchPopDown];

所有这一切都很棒,花花公子。但是我注意到一些奇怪的事情。在iPhone上,这个视图最终会被调整大小以覆盖我应用程序底部的UITabBar。但是在iPad上它可以正确调整大小以补偿UITabBar。有什么想法吗?

All of this works great and dandy. However I've noticed something strange. On the iPhone this view will end up being resized to cover the UITabBar at the bottom of my app. But on an iPad it gets resized correctly to compensate for the UITabBar. Any ideas why?

谢谢

=============== ==

=================

以下是一些描述此问题的屏幕截图。当视图加载虚假视图到所有内容时,这就是它的样子。视图显示(就用户而言只是视图和导航栏上的按钮略有变化。当你搜索到这个假视图时,消失显示下面的真实视图与搜索结果。在ipad上假视图不不要覆盖标签栏。为什么不在iphone上这样做?

Here are some screenshots describing the issue. This is what it looks like when the view loads with the fake view onto of everything. The view shows up (as far as the user is concerned just the view and the buttons on the navbar have changed slightly. When you have searched this fake view disappears revealing the real view below with the search results. ON the ipad the fake view doesn't cover the tab bar. Why doesn't it do this on the iphone also?

==========

==========

编辑2
另一个奇怪的事情。我正在生成日志消息以获得导航控制器的高度。它取决于我是否正常显示或作为模态视图显示而没有标签栏。

edit 2 Another weird thing. I'm generating log messages to get what the height of the navigation controller is. It changing by 49 depending on if I display normally or present as a modal view and there is no tab bar.

所以日志说431应该是正确的高度。我进入界面构建器并设置一个简单的粉红色视图,在431测量,看起来很棒:)但是,当我手动将大小设置为431时,它不起作用。我必须将大小设置为298以使其正常工作...很奇怪......

So the log says 431 should be the correct height. I go into interface builder and setup a simple pink view that's measured at 431 and it looks great :) However when I manually set the size to 431 it doesn't work. I have to set the size to 298 to get this to work correctly ... weird...

看到粉红色的条形图?它实际上是431高...日志说这是我的观点..但它不是:/

See the pink bar? It is literally 431 tall... and the log says that's what my view is.. but it's not :/

============

============

编辑:3

我已将此跟踪到imagebackground,泡泡徽标调整不正确...

I have traced this to the imagebackground with the bubble logo resizing incorrectly...

推荐答案

我必须检查imageview所在的父视图中的剪辑子视图...修复了问题......

I had to check "clip subview" on the parent view that the imageview was in... fixed the problem...

这篇关于自定义UIView覆盖iPhone上的UITabBar而不是iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆