【发布时间】:2014-03-31 02:23:24
【问题描述】:
通过设置半透明 true 并更改背景 alpha,我有一个透明的 UIToolbar。如何使工具栏按钮不透明?我尝试添加这样的非透明图像:
CGRect rect = CGRectMake(0, 0, ([AppDelegate isInIPad])?768:320, 20);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [[UIColor redColor] CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.filterButton setBackgroundImage:image forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
【问题讨论】:
标签: ios7 uibarbuttonitem uitoolbar