1
我正在寻找一种方法来链接功能为用户的行动工作表的按钮如何用swift激活动作表按钮?
我做了删除按钮的功能,但我需要的报告按钮,使用户能够发送电子邮件,如何用迅速做到这一点?谢谢
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]
}
烨它是正确的答案,也关闭邮件编辑器添加此代码 func mailComposeController(controller:MFMailComposeViewController!,didFinishWithResult result:MFMailComposeResult,error:NSError!){ self.dismissViewControllerAnim ated(true,completion:nil) } – 2015-04-04 07:13:51