SWIFT顯示底部的工具條

來源:互聯網
上載者:User

標籤:

有以下頁面顯示我的訊息,使用者可以點擊右上方的編輯按鈕進入刪除狀態。點擊編輯按鈕後,按鈕文字改為“取消”,左上方的按鈕變為“全選”,同時顯示底部工具條帶有“刪除”按鈕

實現起來挺簡單的,在正常狀態下點擊編輯按鈕的方法內寫入:

self.navigationController?.setToolbarHidden(false, animated: true)var btnDelete = UIBarButtonItem(title: "刪除", style: UIBarButtonItemStyle.Plain, target: self, action: "deleteAction")self.setToolbarItems([btnDelete], animated: true)

左上方的按鈕改為“全選”

var selectAllButton = UIBarButtonItem(title: "全選", style: UIBarButtonItemStyle.Plain, target: self, action: "selectAll")navigationItem.leftBarButtonItem = selectAllButton

 so easy!!!

SWIFT顯示底部的工具條

相關文章

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.