1
Я ищу способ связать кнопки рабочего листа, функциональные для пользователяКак активировать кнопки листа действий с быстрым?
Я сделал функциональную кнопку «Удалить», но мне нужно, чтобы кнопка «Отчет» позволяла пользователю отправлять электронную почту, как сделать это быстро? Спасибо
override func tableView(tableView: UITableView,editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject]? {
var ReportAction = UITableViewRowAction(style: .Default, title: "Report User", handler: {(action: UITableViewRowAction! , indexPath:NSIndexPath!) -> Void in
let ReportMenu = UIAlertController(title: nil, message: "Report using", preferredStyle: UIAlertControllerStyle.ActionSheet)
let Reportbutton = UIAlertAction(title: "E-Mail", style: .Default , handler: nil)
ReportMenu.addAction(Reportbutton)
self.presentViewController(ReportMenu, animated: true, completion: nil)
})
var DeleteButton = UITableViewRowAction(style: UITableViewRowActionStyle.Default , title: "Delete", handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
self.Array1.removeAtIndex(indexPath.row)
self.Array2.removeAtIndex(indexPath.row)
self.Array3.removeAtIndex(indexPath.row)
self.Array4.removeAtIndex(indexPath.row)
self.Array5.removeAtIndex(indexPath.row)
self.tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
}
)
return [DeleteButton , ReportAction]
}
Yup это правильный ответ, а также для отклонения компоновщика почты добавьте этот код func mailComposeController (контроллер: MFMailComposeViewController !, doneFinishWithResult result: MFMailComposeResult, ошибка: NSError!) { self.dismissViewControllerAnim ated (true, completion: noil) } –