Please try to describe what you really want to achieve and what is the difficulty you are currently experiencing.
Please explain why this cannot be a solution for you:
@IBOutlet weak var button1WithImages: UIButton!
@IBOutlet weak var button2WithImages: UIButton!
@IBOutlet weak var button3WithImages: UIButton!
@IBOutlet weak var button4WithImages: UIButton!
@IBOutlet weak var button5WithImages: UIButton!
@IBOutlet weak var button6WithImages: UIButton!
@IBOutlet weak var button7WithImages: UIButton!
@IBOutlet weak var button8WithImages: UIButton!
@IBOutlet weak var button9WithImages: UIButton!
@IBAction func removeImages(_ sender: AnyObject) {
self.button1WithImages.setImage(nil, for: .normal)
self.button2WithImages.setImage(nil, for: .normal)
self.button3WithImages.setImage(nil, for: .normal)
self.button4WithImages.setImage(nil, for: .normal)
self.button5WithImages.setImage(nil, for: .normal)
self.button6WithImages.setImage(nil, for: .normal)
self.button7WithImages.setImage(nil, for: .normal)
self.button8WithImages.setImage(nil, for: .normal)
self.button9WithImages.setImage(nil, for: .normal)
}