zoukankan      html  css  js  c++  java
  • UIImageView上添加Button不能响应点击事件[转]

    View Code
     1     UIImageView *backImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-UITABBAR_HEIGHT-216-39, 320, 43) ];
     2     [backImageView setUserInteractionEnabled:YES];//使添加其上的button有点击事件
     3     [backImageView setImage:[UIImage imageNamed:@"navigationBar.png"]];
     4     [backScroll addSubview:backImageView];
     5     
     6     UIButton *loginButton = [UIButton alloc];
     7     [loginButton setFrame:CGRectMake(10, 0, 40, 43)];
     8     [loginButton setTitle:@"hello" forState:UIControlStateNormal];
     9     [loginButton addTarget:self action:@selector(loginOrLogout) forControlEvents:UIControlEventTouchUpInside];
    10     [backImageView addSubview:loginButton

    以上代码是在一张图片上面添加按钮,并让按钮在图片上面能够响应按钮的事件的做法。

    吾屋无污,吴捂屋污,诬吾污屋,吾晤吴污,吾无物污,吴侮污吾,吾忤吴屋,悟吴诬吾,污屋吴污,吴侮吾污,吾勿武侮,吾唔吴误,诬侮污吾,吾屋悟忤.
  • 相关阅读:
    linux I2C 读写 tlv320dac3100
    ubuntu lfs
    安装和使用花生壳(linux)
    vim 配置
    vim
    gnome2 恢复默认 panel
    ubuntu 挂在 jffs2 文件
    gstreamer 播放
    gstreamer 环境变亮设置
    探讨【IGE】的源代码【五】。
  • 原文地址:https://www.cnblogs.com/chenxiangxi/p/2718052.html
Copyright © 2011-2022 走看看