您的位置:首页 > 移动开发 > IOS开发

ios 自定义Button 不能点击问题

2014-09-03 10:54 281 查看
- (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不能打开,今天郁闷死了.最后找的了原来是它.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: