[英]UINavigationBar background shadow
I'm experiencing a weird problem when I segue to a UIViewController I've made. 当我选择制作的UIViewController时,遇到了一个奇怪的问题。 ViewController B (the one I segue to) has a UIView that slides down using the TransitionCoordinator and constraints, but it shows a grey shadow at the right, like so:
ViewController B(我选择使用的那个)有一个UIView,它使用TransitionCoordinator和约束向下滑动,但在右侧显示了灰色阴影,如下所示:
Once the segue is completely done, it goes back to translucent and displays the blue UIView through the UINavigationBar with a nice blur. 设置完成后,它会恢复为半透明,并通过UINavigationBar呈现蓝色的UIView,并带有漂亮的模糊效果。
This grey shadow is most likely due to a UIToolBar and UISegmentedControl within that toolbar on the UITableViewController that I segue from. 此灰色阴影很可能是由于我从中选择的UITableViewController的该工具栏中的UIToolBar和UISegmentedControl所致。 It looks like this:
看起来像这样:
I'm using this code together with my UIToolBar: 我将这段代码与UIToolBar一起使用:
- (UIBarPosition)positionForBar:(id<UIBarPositioning>)bar {
return UIBarPositionTopAttached;
}
I've tried to use a TransitionCoordinator to fade out the UIToolBar using it's alpha property, but without success. 我试图使用TransitionCoordinator使用其alpha属性淡出UIToolBar,但是没有成功。 I've also visited other similar questions on SO, but I haven't gotten anywhere.
我还访问了SO上的其他类似问题,但是我什么都没得到。
The strange thing is that it sometimes work as it should, but I can't figure out why it doesn't always happen nor how to completely remove it. 奇怪的是,它有时会按其应有的方式工作,但是我无法弄清楚为什么它并不总是发生,也不知道如何将其完全删除。
view hierarchy: 视图层次结构:
Xcode view hierarchy: Xcode视图层次结构:
View hierarchy in list: 查看列表中的层次结构:
Transparent navigationBar: 透明的导航栏:
More information: 更多信息:
Thanks! 谢谢!
- (void)removeShadowLineFromNavBar{
for (UIView *view in self.navigationController.navigationBar.subviews) {
for (UIView *view2 in view.subviews) {
if ([view2 isKindOfClass:[UIImageView class]]) {
[view2 removeFromSuperview];
}
}
}
}
That line is a UIImageView
inside UINavigationBar as a subview. 该行是UINavigationBar内的
UIImageView
作为子视图。 Going through subviews you can remove it just like any other view from its super view. 通过子视图,您可以将其删除,就像从其超级视图中删除其他任何视图一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.