func tapColor(sender: UIGestureRecognizer) {
let paraList = [
"Grey","Black","Brown"
]
func actionSheetHandlerParameters(para : String) {
ColorLabel.text = para
ColorLabel.textColor = UIColor.blackColor()
}
let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
//actionSheet.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
for item in paraList {
actionSheet.addAction(UIAlertAction(title: item, style: .Default, handler: { _ in
actionSheetHandlerParameters(item) // .SavedPhotosAlbum
}))
}
presentViewController(actionSheet, animated: false, completion: {
//valert.view.superview.subviews[1]
actionSheet.view.superview?.subviews[1].userInteractionEnabled = true
actionSheet.view.superview?.subviews[1].addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.alertControllerBackgroundTapped)))
})
}
func alertControllerBackgroundTapped()
{
self.dismissViewControllerAnimated(true, completion: nil)
}