i am intrested in accessing the uibutton method from external method but i getting lot of errors :  
 below is my code , i have 9 buttons in my view whose background image is to be changed.. please help me out. thanks in advance....    

import UIKit

class ViewController: UIViewController {

    let alerts = UIAlertController(title: "Hi", message: "Hello", preferredStyle: UIAlertControllerStyle.alert)
    
    let action1 = UIAlertAction(title: "Yes", style: UIAlertActionStyle.default) { (<#UIAlertAction#>) in
        
            for i in 0..<9
            {
                
                let newButton = self.view.viewWithTag(i) as! UIButton
                newButton.setBackgroundImage(UIImage.init(named: ""), for: .normal)

        }
    }
    
 
    @IBAction func buttonPressed(_ sender: UIButton)
    {
        sender.setBackgroundImage(UIImage.init(named: "cross.png"), for:.normal)
    
    }
}
