У меня на UIView есть рамка со слоем. У меня есть слой, устанавливающий цвет фона, альфа 0.5 и frame.backgroundColor = clearColor, чтобы люди могли видеть линии позади него. Однако это делает подпредставления, которые содержат текст, также затухшими. Как мне это предотвратить?
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self setAlpha:kAlpha];
CALayer *layer = [self layer];
[layer setMasksToBounds:YES];
[layer setBackgroundColor:[UIColor redColor].CGColor];
[layer setCornerRadius:kCornerRadius];
}
return self;
}
- (id)init
{
if (self = [super init]) {
self.clipsToBounds = YES;
self.userInteractionEnabled = YES;
self.multipleTouchEnabled = NO;
tileTitle = [[UILabel alloc] init];
tileTitle.textColor = [UIColor blackColor];
tileTitle.backgroundColor = [UIColor clearColor];
tileTitle.font = [UIFont boldSystemFontOfSize:13.0f];
tileDescription = [[UILabel alloc] init];
tileDescription.textColor = [UIColor blackColor];
tileDescription.backgroundColor = [UIColor clearColor];
tileDescription.font = [UIFont systemFontOfSize:11.0f];
tileDescription.lineBreakMode = UILineBreakModeTailTruncation;
[self addSubview:tileTitle];
[self addSubview:tileDescription];
}
return self;
}