@IBAction func areaAdd(_ sender: Any) {
haptic.prepare()
haptic.impactOccurred()
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let areaImage = UIImage(named: "Areas")
let area = UIAlertAction(title: "Area", style: .default, handler: { action in self.performSegue(withIdentifier: "newArea", sender: self)})
area.setValue(areaImage?.withRenderingMode(.alwaysTemplate), forKey: "image")
alert.addAction(area)
let project = UIAlertAction(title: "Project", style: .default, handler: { action in self.performSegue(withIdentifier: "newProject", sender: self)})
let projectImage = UIImage(named: "Projects")
area.setValue(projectImage?.withRenderingMode(.alwaysTemplate), forKey: "image")
alert.addAction(project)
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
}
答案 0 :(得分:0)
@IBAction func areaAdd(_ sender: Any) {
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let area = UIAlertAction(title: "Area", style: .default, handler: { action in
self.performSegue(withIdentifier: "newArea", sender: self)
})
let image = UIImage(named: "myImage")
area.setValue(image?.withRenderingMode(.alwaysOriginal), forKey: "image")
alert.addAction(area)
}