iphone - UIToolbar渐变修复

标签 iphone ios objective-c uitoolbar

我在我的项目中使用 UIToolbar 作为此锁定屏幕。一切都很好,除了 UIToolbar 上的渐变非常短。我的意思是它的高度不相等。我已附上屏幕截图。我希望 UIToolbar 像图 B 那样。

知道如何实现这一目标。 enter image description here

最佳答案

您能做的最好的事情就是设置 UIToolBar 的外观:

UIImage *gradientImage = [[UIImage imageNamed:@"upperBar.png"]
                                resizableImageWithCapInsets:UIEdgeInsetsMake(-4, 300, 10, 300)];
UIToolbar *toolbar = [UIToolBar appearance];
[toolbar setBackgroundImage:gradientImage forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];

其中upperBar.png是你想要的渐变图像。

关于iphone - UIToolbar渐变修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17829509/

相关文章:

iphone - 如何在 iOS 中通过滑动手势实现卷页?

iphone - 我怎样才能换行 OHAttributedLabel

c++ - 在 Mac 上使用 PJSIP 进行回声消除

ios - NSSortDescriptor与Comparator使用实际对象而不是键值

objective-c - 自动释放的对象什么时候真正释放?

iphone - 使用标签栏和导航 Controller , View 被解除到错误的 View

ios - 防止为 STTweetLabel 调用 didSelectRowAtIndexPath

ios - UIWebview 不能很好地显示 iOS 8 的嵌入式 youtube

ios - 如何在用作显示输入元素的小表格的 uitableview 中滚动时存储输入的数据?

iphone - 如何拦截点击 UITextView 中的链接?