- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.userInteractionEnabled = YES;
[self createButton];
}
return self;
}
-(void)createButton
{
_rightLabel = [[UILabel alloc]init];
_rightLabel.frame = CGRectMake(10, 0, 100-10,30);
NSLog(@"%f %f",self.frame.size.height,self.frame.size.width);
_rightLabel.text = @"999999";
_rightLabel.textColor = [UIColor whiteColor];
// _rightLabel.userInteractionEnabled = YES;(罪魁祸首)
_rightLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:_rightLabel];
}
在uibutton里面定义的元素的userInteractionEnabled不能打开,今天郁闷死了.最后找的了原来是它.