button点击无反应

来源:互联网 发布:火车采集器 linux 编辑:程序博客网 时间:2024/04/28 03:40
我的代码:
{       UIImageView *rjUnpBagV=[[UIImageView alloc]initWithFrame:Frame(0, 0, ScreenWidth, ScreenHeight)];    self.rjUnpBagV.backgroundColor=[UIColor whiteColor];    [self.view addSubview:self.rjUnpBagV];    UIButton *rjPublishBtn=[UIButton buttonWithType:UIButtonTypeSystem];    rjPublishBtn.frame=Frame(ScreenWidth/4, rjUnpImgV.frame.origin.y+rjUnpImgV.frame.size.height+10, ScreenWidth/2, 30);    [rjPublishBtn setTitle:@"发布职位" forState:UIControlStateNormal];    [rjPublishBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];    [rjPublishBtn setBackgroundColor:[UIColor colorWithRed:0.33 green:0.79 blue:0.76 alpha:1]];    [self.rjUnpBagV addSubview:rjPublishBtn];    [rjPublishBtn addTarget:self action:@selector(rjPublishBtnAction) forControlEvents:UIControlEventTouchUpInside];}-(void)rjPublishBtnAction{    NSLog(@"点击");}


btn不能点击的原因-----父视图没有开用户交互的话,子视图也不能点击


UIImageView是需要开用户交互的。

0 0
原创粉丝点击