I am working with buttons with an image on them. The central idea is there are 6 image buttons with default images on them and on click of any of those buttons: for example, if there are 1,2,3,4,5,6 buttons, on click of 1 the images for 2,3,4,5,6 and on click of 2 the images for 1,3,4,5,6 change and so on. Also on the click of a separate button with title "Submit" I want it to save which button was clicked out of the 1,2,3,4,5,6 buttons.
I am able to do it using 6 different actions for 6 Buttons but i need to use Collection outlet
Please Suggest
Instead of using Collection of Outlet use one IBAction for all and just give different tag all six buttons create action like bellow:-
@IBAction func buttonOfOneToThree(_ sender: UIButton) {
//MARK:- Below code print your selected button title and tag
print(sender.tag)
print(sender.titleLabel!.text!)
}
this will fulfil you requirement but if you want to learn collection outlet and action handling please refer this tutorial:-enter link description here