iOS筆記【儲存格右滑手勢】 2017-09-09

來源:互聯網
上載者:User

標籤:action   path   round   col   and   分享   can   func   dex   

// 響應儲存格右滑手勢override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {        let actionShare = UITableViewRowAction(style: .normal, title: "分享") { (_,IndexPath) in            // 定義滑動菜單樣式和標題            let actionSheet = UIAlertController(title: "分享到", message: nil, preferredStyle: .actionSheet)            // 定義按鈕            let optionQQ = UIAlertAction(title: "QQ", style: .default, handler: nil)            let optionWeiXin = UIAlertAction(title: "", style: .default, handler: nil)            let optionCancel = UIAlertAction(title: "取消", style: .cancel, handler: nil)            // 把option操作添加到actionSheet中            actionSheet.addAction(optionQQ)            actionSheet.addAction(optionWeiXin)            actionSheet.addAction(optionCancel)            // 顯示            self.present(actionSheet, animated: true, completion: nil)        }        // 配置按鈕顏色        actionShare.backgroundColor = UIColor.orange        let actionDel = UITableViewRowAction(style: .destructive, title: "刪除") { (_, IndexPath) in            // 刪除相對應的每行資料            self.areaImages.remove(at: indexPath.row)            self.areaProvice.remove(at: indexPath.row)            self.areas.remove(at: indexPath.row)            self.areaType.remove(at: indexPath.row)            self.visted.remove(at: indexPath.row)            // Delete the row from the data source            tableView.deleteRows(at: [indexPath], with: .fade)        }                let actionTop = UITableViewRowAction(style: .default, title: "置頂") { (_, _) in                    }        actionTop.backgroundColor=UIColor(red: 245/255, green: 199/255, blue: 221/255, alpha: 1)                        // 返回滑動子功能表數組        return [actionShare,actionDel,actionTop]    }

 

iOS筆記【儲存格右滑手勢】 2017-09-09

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.