UITableViewController的圆角 [英] Round corners of UITableViewController
问题描述
我正在尝试使用以下代码来处理 UITableViewController
甚至整个 UINavigationController
的角落:
I am trying to round the corners of a UITableViewController
or even the entire UINavigationController
using the following code:
self.view.layer.cornerRadius = 8.0f;
问题是,当对视图进行四舍五入时, UINavigationBar
的半透明,冷淡的背景显示在圆角边缘的外部.我想使导航栏保持半透明,但我希望整个视图都经过四舍五入.使用上面的代码,我得到以下结果:
The problem though is that when the view is rounded off, the UINavigationBar
has a translucent, frosty background showing outside the rounded edges. I want to keep the navigation bar translucent, but I want the entire view to be rounded. With the code above, I get the following result:
如何在圆角外不显示冷淡的背景的情况下产生此结果?
How can I produce this result without the frosty background showing outside the rounded corners?
推荐答案
self.view.clipsToBounds = YES;
//编辑//实际上,因为它可能是您想要的导航栏
//edit// actually, because its the nav bar there you probably want
self.navigationController.view.layer.cornerRadius = 8.0;
self.navigationController.view.clipsToBounds = YES;
///
这篇关于UITableViewController的圆角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!