【发布时间】:2016-02-17 10:04:26
【问题描述】:
这是我的代码
cell.imageView.contentMode = .ScaleAspectFit
cell.imageView.image = UIImage(named: "dummyImage")
cell.button.backgroundColor = UIColor.grayColor()
cell.button.setTitleColor(UIColor.whiteColor(), forState: .Normal)
cell.button.titleLabel?.font = UIFont.systemFontOfSize(8.0)
cell.button.setTitle("PRESS HERE", forState: .Normal)
cell.button.addTarget(self, action: "pressed:", forControlEvents: UIControlEvents.
cell.imageView.addSubview(cell.button)
按钮正在显示并覆盖图像,但选择器
按下
当我点击按钮时没有被调用。帮助。
【问题讨论】:
-
你能发图片吗?您是否将按钮添加为 uiimage 的子视图?
-
不需要这个
cell.imageView.addSubview(cell.button),如果你想为图片点击操作 -
@Anbu.Karthik 如果我不添加 cell.imageView.addSubview(cell.button) ,按钮会被图像隐藏
标签: ios swift uibutton uiimage