如何从iPhone顶部删除白色条

时间:2022-12-05 22:22:08

I have a UITabBarController in my application. In the first view of this controller I have a UINavigatioController and user can navigate to multiple views through this NavigationController. In the rootview of this controller I have my frontview or main view of the application which have an info icon, which flips the screen to info page which is an another view in my appDelegate. So I use the following code from my appdelegate to switch to info page.

我的应用程序中有一个UITabBarController。在这个控制器的第一个视图中,我有一个UINavigatioController,用户可以通过这个NavigationController导航到多个视图。在这个控制器的根视图中,我有我的应用程序的前视图或主视图,它有一个信息图标,它将屏幕翻转到信息页面,这是我的appDelegate中的另一个视图。所以我使用appdelegate中的以下代码切换到信息页面。

UIView * controllersView = [aboutUsViewController view];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
[self.window addSubview:controllersView];
//[aboutUsViewController animateView];
[self.tabBarController.view removeFromSuperview];
[UIView commitAnimations];

My problem is when I flip, I see a very small white bar at the top. This white bar is seen only while fliping from main view that is first screen to info page and not viceversa.

我的问题是,当我翻转时,我看到顶部有一个非常小的白色条。只有从第一个屏幕的主视图到信息页面而不是反之亦然时,才会看到此白条。

I am confused how to remove this bar since I have a UIImage covering my whole page on the mainview.

我很困惑如何删除这个栏,因为我在主视图上覆盖了整个页面的UIImage。

How to solve this.

怎么解决这个问题。

7 个解决方案

#1


2  

If the bar is only visible during a transition, then change the color of your main window to be the same as the view you are transitioning. Or you can make it totally translucent, which may do the same.

如果条形图仅在转换期间可见,则将主窗口的颜色更改为与要转换的视图相同。或者你可以使它完全半透明,这可能会做同样的事情。

#2


0  

I had the same problem. I think this is a bug in the 3.1 OS. File a bug with Apple. My current workaround was to use the standard slide up modal transition. Not the best solution, but at least it doesn't look weird.

我有同样的问题。我认为这是3.1操作系统中的一个错误。提交Apple的错误。我目前的解决方法是使用标准的上滑模式转换。不是最好的解决方案,但至少它看起来并不奇怪。

#3


0  

Have you tried setting wantsFullScreenLayout on your view controller?

您是否尝试在视图控制器上设置wantsFullScreenLayout?

#4


0  

I'm not sure if you are displaying the status bar or not, but you may want to check if your UIImage size completely goes to the top of your view - especially if you've added it in IB. Also, try setting the cache setting in your transition to NO to see if that makes a difference. It uses more resources, but I've had to do that to stop text fields from blanking out during a transition.

我不确定您是否正在显示状态栏,但您可能想要检查您的UIImage大小是否完全位于您的视图顶部 - 特别是如果您已将其添加到IB中。此外,尝试将转换中的缓存设置设置为NO,以查看是否会产生影响。它使用了更多的资源,但我必须这样做才能阻止文本字段在转换期间消隐。

#5


0  

You probably shouldn't be doing all those animations yourself. I'm not exactly sure what your goal is, but it might be easier to use something called "pushModalViewController" and have a controller for your info page, along with a view. This may fix the problem, because it may just be something to do with animations.

你可能不应该自己做所有这些动画。我不确定你的目标是什么,但是可能更容易使用一个名为“pushModalViewController”的东西,并为你的信息页面提供一个控制器,以及一个视图。这可能会解决问题,因为它可能与动画有关。

Then, when you exit your info page, control returns to your navigation controller (which is what I think you want). I hope this helps.

然后,当您退出信息页面时,控制权将返回导航控制器(这是我认为您想要的)。我希望这有帮助。

#6


0  

I had the same puzzle/riddle/problem: after switching back from a modal view the underlying view had a light blue status bar, which showed for half a second:

我有同样的谜题/谜语/问题:从模态视图切换回来后,底层视图有一个浅蓝色状态栏,显示半秒:

如何从iPhone顶部删除白色条

However, because I did take this screenshot, I realized it's not the status bar, but some distant remainder of the navigation bar. I switched navigation bar off in the app delegate, but here it still, and only during the transition (after the UIModalTransitionStyleFlipHorizontal transition there was no blue bar)

但是,因为我确实采用了这个截图,我意识到它不是状态栏,而是导航栏的一些遥远的剩余部分。我在app delegate中关闭了导航栏,但在这里它仍然是,并且仅在转换期间(在UIModalTransitionStyleFlipHorizo​​ntal过渡之后没有蓝色条)

Therefore what I did was giving it a translucent color:

因此,我所做的是给它一种半透明的颜色:

self.title = @"";
self.navigationController.navigationBar.tintColor = [UIColor clearColor];

Might not be the world's finest solution, but it's not a bug with Apple.

可能不是世界上最好的解决方案,但它不是Apple的错误。

#7


0  

If you are working on ionic2 then here is the code-

如果您正在使用ionic2,那么这里是代码 -

let config = {statusbarPadding: false};
ionicBootstrap(MyApp, null, config);

This worked for me! Here it is in more details-
ionic2 how to remove white space from status bar from top in iphone

这对我有用!这里有更详细的介绍 - ionic2如何从iphone的顶部状态栏中删除空白区域

#1


2  

If the bar is only visible during a transition, then change the color of your main window to be the same as the view you are transitioning. Or you can make it totally translucent, which may do the same.

如果条形图仅在转换期间可见,则将主窗口的颜色更改为与要转换的视图相同。或者你可以使它完全半透明,这可能会做同样的事情。

#2


0  

I had the same problem. I think this is a bug in the 3.1 OS. File a bug with Apple. My current workaround was to use the standard slide up modal transition. Not the best solution, but at least it doesn't look weird.

我有同样的问题。我认为这是3.1操作系统中的一个错误。提交Apple的错误。我目前的解决方法是使用标准的上滑模式转换。不是最好的解决方案,但至少它看起来并不奇怪。

#3


0  

Have you tried setting wantsFullScreenLayout on your view controller?

您是否尝试在视图控制器上设置wantsFullScreenLayout?

#4


0  

I'm not sure if you are displaying the status bar or not, but you may want to check if your UIImage size completely goes to the top of your view - especially if you've added it in IB. Also, try setting the cache setting in your transition to NO to see if that makes a difference. It uses more resources, but I've had to do that to stop text fields from blanking out during a transition.

我不确定您是否正在显示状态栏,但您可能想要检查您的UIImage大小是否完全位于您的视图顶部 - 特别是如果您已将其添加到IB中。此外,尝试将转换中的缓存设置设置为NO,以查看是否会产生影响。它使用了更多的资源,但我必须这样做才能阻止文本字段在转换期间消隐。

#5


0  

You probably shouldn't be doing all those animations yourself. I'm not exactly sure what your goal is, but it might be easier to use something called "pushModalViewController" and have a controller for your info page, along with a view. This may fix the problem, because it may just be something to do with animations.

你可能不应该自己做所有这些动画。我不确定你的目标是什么,但是可能更容易使用一个名为“pushModalViewController”的东西,并为你的信息页面提供一个控制器,以及一个视图。这可能会解决问题,因为它可能与动画有关。

Then, when you exit your info page, control returns to your navigation controller (which is what I think you want). I hope this helps.

然后,当您退出信息页面时,控制权将返回导航控制器(这是我认为您想要的)。我希望这有帮助。

#6


0  

I had the same puzzle/riddle/problem: after switching back from a modal view the underlying view had a light blue status bar, which showed for half a second:

我有同样的谜题/谜语/问题:从模态视图切换回来后,底层视图有一个浅蓝色状态栏,显示半秒:

如何从iPhone顶部删除白色条

However, because I did take this screenshot, I realized it's not the status bar, but some distant remainder of the navigation bar. I switched navigation bar off in the app delegate, but here it still, and only during the transition (after the UIModalTransitionStyleFlipHorizontal transition there was no blue bar)

但是,因为我确实采用了这个截图,我意识到它不是状态栏,而是导航栏的一些遥远的剩余部分。我在app delegate中关闭了导航栏,但在这里它仍然是,并且仅在转换期间(在UIModalTransitionStyleFlipHorizo​​ntal过渡之后没有蓝色条)

Therefore what I did was giving it a translucent color:

因此,我所做的是给它一种半透明的颜色:

self.title = @"";
self.navigationController.navigationBar.tintColor = [UIColor clearColor];

Might not be the world's finest solution, but it's not a bug with Apple.

可能不是世界上最好的解决方案,但它不是Apple的错误。

#7


0  

If you are working on ionic2 then here is the code-

如果您正在使用ionic2,那么这里是代码 -

let config = {statusbarPadding: false};
ionicBootstrap(MyApp, null, config);

This worked for me! Here it is in more details-
ionic2 how to remove white space from status bar from top in iphone

这对我有用!这里有更详细的介绍 - ionic2如何从iphone的顶部状态栏中删除空白区域