问题描述
我试图做一个自定义UINavigationBar,但问题是我的背景图片有一个曲线,它的一点点比默认导航栏大。当我尝试设置背景图像和更改导航栏的大小,它只是缩放图像作为一个矩形。有任何想法?
酒吧:
覆盖
- (CGSize)sizeThatFits:(CGSize)size {
return CGSizeMake(custom_width,custom_height);
}
,以返回自定义导航栏的大小。
请注意,如果您使用的高度不是4的倍数,那么如果您隐藏,然后在任何点显示导航栏(它将移动1像素顶部)
I'm trying to make a custom UINavigationBar, but the problem is that my background image has a curve in it, and its little bit larger than default navigation bar. When I try to set background image and change navigation bar size, its just scales image as a rectangle. Any ideas?
Bar:
Override
- (CGSize) sizeThatFits:(CGSize)size {
return CGSizeMake(custom_width, custom_height);
}
in order to return the size for your custom navigation bar.
Note that if you use a height that is not a multiple of 4, it will cause trouble if you hide and then show the navigation bar at any point (it gets shifted by 1 pixel from the top)
这篇关于UINavigationBar有形状的背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!