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