标签:style color 使用 文件 width for
TranslucentToolbar.h文件
#import <UIKit/UIKit.h>
@interface TranslucentToolbar : UIToolbar
@end
TranslucentToolbar.m文件
#import "TranslucentToolbar.h"
@implementation TranslucentToolbar
- (id)initWithFrame:(CGRect)aRect {
if ((self = [super initWithFrame:aRect])) {
self.opaque = NO;
self.backgroundColor = [UIColor colorWithRed:34.0/255.0 green:39.0/255.0 blue:42.0/255.0 alpha:0.8];
self.clearsContextBeforeDrawing = YES;
}
return self;
}
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
@end
在需要创建的地方使用子类化的UIToolbar:
_bottomBar =[[TranslucentToolbar alloc] initWithFrame:CGRectMake(0, height-botH, width, botH)];
标签:style color 使用 文件 width for
原文地址:http://blog.csdn.net/leochang130731/article/details/37818521