for (index,phoneNum) in temp_arr_phoneNum.enumerated()
{
if temp_arr_msgType[index] == "3"
{
let btnimage : UIButton = UIButton()
btnimage.setBackgroundImage(UIImage(named:"VideoIConDefault"), for: .normal)
btnimage.tag = index
btnimage.translatesAutoresizingMaskIntoConstraints = false
btnimage.isUserInteractionEnabled = true
containerView.addSubview(btnimage)
btnimage.addTarget(self, action:
#selector(self.tapDetected(_:)), for:UIControlEvents(rawValue: 0))
arrayForBtnViews.append(btnimage)
}
}
func tapDetected(_ sender: UIButton)
{
}
Only for the first button Action Target method is working......Other buttons are not performing clicked actions...(controlEvents,,, I tried for .touchUpInside also).....Button frames have been set through auto layout constraints programatically in other methods.