首页 > 其他 > 详细

UIImageView上添加Button不能响应点击事件

时间:2016-04-15 15:28:04      阅读:294      评论:0      收藏:0      [点我收藏+]

    UIImageView *backImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-UITABBAR_HEIGHT-216-39, 320, 43) ];

    [backImageView setUserInteractionEnabled:YES];//使添加其上的button有点击事件

    [backImageView setImage:[UIImage imageNamed:@"navigationBar.png"]];

    [backScroll addSubview:backImageView];

    

    UIButton *loginButton = [UIButton alloc];

    [loginButton setFrame:CGRectMake(10, 0, 40, 43)];

    [loginButton setTitle:@"hello" forState:UIControlStateNormal];

    [loginButton addTarget:self action:@selector(loginOrLogout) forControlEvents:UIControlEventTouchUpInside];

    [backImageView addSubview:loginButton];

来源:http://blog.sina.com.cn/s/blog_9c3c519b0100yhfh.html

 

UIImageView上添加Button不能响应点击事件

原文:http://www.cnblogs.com/yipingios/p/5395567.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!