TodoTaskViewController.swift 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. //
  2. // TodoTaskViewController.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 16/8/1.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import Alamofire
  10. import AlamofireImage
  11. import AlamofireObjectMapper
  12. import SwiftyJSON
  13. import ObjectMapper
  14. import CocoaLumberjack
  15. struct TaskURLGenenater {
  16. var url:String
  17. var pageModel:CommonPageModel
  18. func pagingURL() -> String {
  19. var tUrl = self.url
  20. tUrl = AppDelegate.o2Collect.setRequestParameter(tUrl, requestParameter:self.pageModel.toDictionary() as [String : AnyObject]?)!
  21. return tUrl.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed)!
  22. }
  23. // mutating func nextPage(_ pageModel:CommonPageModel?) -> String {
  24. // if let pModel = pageModel {
  25. // self.pageModel = pModel
  26. // }
  27. // var tUrl = self.url
  28. // tUrl = AppDelegate.o2Collect.setRequestParameter(tUrl, requestParameter:self.pageModel.toDictionary() as [String : AnyObject]?)!
  29. // return tUrl.addingPercentEscapes(using: String.Encoding.utf8)!
  30. // }
  31. }
  32. class TodoTaskViewController: UITableViewController {
  33. var segmentedControl:SegmentedControl!
  34. var currentTaskURLGenenater:TaskURLGenenater!
  35. var models:[TodoCellModel<TodoTask>] = []
  36. var filterModels:[TodoCellModel<TodoTask>] = []
  37. var emptyTexts:[String] = ["没有要处理的待办","没有要处理的待阅","没有已办数据","没有已阅数据"]
  38. var urls:[Int:TaskURLGenenater] {
  39. let todoTaskURL = AppDelegate.o2Collect.generateURLWithAppContextKey(TaskContext.taskContextKey, query: TaskContext.todoTaskListQuery, parameter: nil,coverted: false)
  40. let todoedTaskURL = AppDelegate.o2Collect.generateURLWithAppContextKey(TaskedContext.taskedContextKey, query: TaskedContext.taskedListByPageSizeQuery, parameter: nil,coverted: false)
  41. let readTaskURL = AppDelegate.o2Collect.generateURLWithAppContextKey(ReadContext.readContextKey, query: ReadContext.readListByPageSizeQuery, parameter: nil,coverted: false)
  42. let readedTaskURL = AppDelegate.o2Collect.generateURLWithAppContextKey(ReadedContext.readedContextKey, query: ReadedContext.readedListByPageSizeQuery, parameter: nil,coverted: false)
  43. return [0: TaskURLGenenater(url: todoTaskURL!,pageModel: CommonPageModel()),2: TaskURLGenenater(url: todoedTaskURL!,pageModel: CommonPageModel()),1 : TaskURLGenenater(url: readTaskURL!,pageModel: CommonPageModel()),3: TaskURLGenenater(url: readedTaskURL!,pageModel: CommonPageModel())]
  44. }
  45. //添加搜索功能
  46. var fileterUrls:[Int:TaskURLGenenater] {
  47. let todoTaskURL = AppDelegate.o2Collect.generateURLWithAppContextKey(TaskContext.taskContextKey, query: TaskContext.todoTaskListFilterQuery, parameter: nil,coverted: false)
  48. let todoedTaskURL = AppDelegate.o2Collect.generateURLWithAppContextKey(TaskedContext.taskedContextKey, query: TaskedContext.taskedListByPageSizeFilterQuery, parameter: nil,coverted: false)
  49. let readTaskURL = AppDelegate.o2Collect.generateURLWithAppContextKey(ReadContext.readContextKey, query: ReadContext.readListByPageSizeFilterQuery, parameter: nil,coverted: false)
  50. let readedTaskURL = AppDelegate.o2Collect.generateURLWithAppContextKey(ReadedContext.readedContextKey, query: ReadedContext.readedListByPageSizeFilterQuery, parameter: nil,coverted: false)
  51. return [0: TaskURLGenenater(url: todoTaskURL!,pageModel: CommonPageModel()),2: TaskURLGenenater(url: todoedTaskURL!,pageModel: CommonPageModel()),1 : TaskURLGenenater(url: readTaskURL!,pageModel: CommonPageModel()),3: TaskURLGenenater(url: readedTaskURL!,pageModel: CommonPageModel())]
  52. }
  53. //搜索文本
  54. var searchText = ""
  55. //搜索控件
  56. var searchController:UISearchController = UISearchController(searchResultsController: nil)
  57. override func viewWillAppear(_ animated: Bool) {
  58. super.viewWillAppear(animated)
  59. self.title = ""
  60. }
  61. override func viewWillDisappear(_ animated: Bool) {
  62. super.viewWillDisappear(animated)
  63. // if self.searchController.isActive {
  64. // self.searchController.isActive = false
  65. // }
  66. // self.searchController.searchBar.removeFromSuperview()
  67. }
  68. override func viewDidLoad() {
  69. super.viewDidLoad()
  70. self.initSegmentedControl()
  71. let taskIndex = AppConfigSettings.shared.taskIndex
  72. self.currentTaskURLGenenater = self.urls[taskIndex]
  73. // //添加搜索功能
  74. self.searchController.searchResultsUpdater = self
  75. self.searchController.delegate = self
  76. self.searchController.dimsBackgroundDuringPresentation = false
  77. self.searchController.hidesNavigationBarDuringPresentation = false
  78. definesPresentationContext = true
  79. UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).title = "取消"
  80. let attrs = [NSAttributedString.Key.font: UIFont.init(name: "PingFangTC-Light", size: 14) ?? UIFont.systemFont(ofSize: 14),
  81. NSAttributedString.Key.foregroundColor: O2ThemeManager.color(for: "Base.base_color") ?? UIColor.red]
  82. UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(attrs, for: .normal)
  83. self.searchController.searchBar.searchBarStyle = UISearchBar.Style.minimal
  84. self.searchController.searchBar.sizeToFit()
  85. // self.searchController.searchBar.backgroundColor = RGB(251, g: 71, b: 71)
  86. // self.searchController.searchBar.setImage(UIImage(named: "contact_search"), for: .search, state: .normal)
  87. // if let searchField = self.searchController.searchBar.value(forKey: "searchField") as? UITextField {
  88. // searchField.textColor = .white
  89. // }
  90. //设置搜索框是否显示
  91. self.setSearchBarIsShow()
  92. //分页刷新功能
  93. self.tableView.mj_header = MJRefreshNormalHeader(refreshingBlock: {
  94. self.headerLoadData()
  95. })
  96. self.tableView.mj_footer = MJRefreshAutoFooter(refreshingBlock: {
  97. self.footerLoadData()
  98. })
  99. self.headerLoadData()
  100. }
  101. //隐藏搜索框
  102. func setSearchBarIsShow(){
  103. let taskIndex = AppConfigSettings.shared.taskIndex
  104. if taskIndex == 2 {
  105. self.tableView.tableHeaderView = self.searchController.searchBar
  106. }else{
  107. if self.searchController.isActive {
  108. self.searchController.isActive = false
  109. }
  110. self.tableView.tableHeaderView = nil
  111. }
  112. }
  113. func headerLoadData(){
  114. DDLogDebug("加载数据。。。。。。。。。")
  115. let taskIndex = AppConfigSettings.shared.taskIndex
  116. if !self.searchController.isActive {
  117. self.currentTaskURLGenenater = self.urls[taskIndex]
  118. self.currentTaskURLGenenater.pageModel = CommonPageModel()
  119. self.loadFirstDataByURL()
  120. }else{
  121. self.currentTaskURLGenenater = self.fileterUrls[taskIndex]
  122. self.currentTaskURLGenenater.pageModel = CommonPageModel()
  123. self.loadFilterFirstDataByURL()
  124. }
  125. //self.loadDataByURL(genernater!.nextPage(nil))
  126. }
  127. func footerLoadData(){
  128. DDLogDebug("获取更多数据。。。。。。。。。。。。。。")
  129. var genernater = self.currentTaskURLGenenater
  130. if !(genernater?.pageModel.isLast())! {
  131. genernater?.pageModel.nextPage()
  132. if !self.searchController.isActive {
  133. self.loadDataNextByURL()
  134. }else{
  135. self.loadFilterNexdataByURL()
  136. }
  137. }else{
  138. DispatchQueue.main.async {
  139. self.showSuccess(title: "已到最后一页,没有更多的数据了")
  140. }
  141. }
  142. }
  143. func loadFilterFirstDataByURL(){
  144. DDLogDebug("查询数据 loadFilterFirstDataByURL")
  145. let tv = self.tableView as! ZLBaseTableView
  146. tv.emptyTitle = self.emptyTexts[AppConfigSettings.shared.taskIndex]
  147. AF.request(self.currentTaskURLGenenater.pagingURL(), method: .post, parameters: ["key":self.searchText], encoding: JSONEncoding.default, headers: nil).responseJSON { (response) in
  148. switch response.result {
  149. case .success(let val):
  150. let type = JSON(val)["type"]
  151. if type == "success" {
  152. self.filterModels.removeAll()
  153. let data = JSON(val)["data"]
  154. let todoTaskArray = Mapper<TodoTask>().mapArray(JSONString: data.description)
  155. if let todoTasks = todoTaskArray {
  156. for task in todoTasks {
  157. let model = TodoCellModel<TodoTask>(title: task.title,applicationName: task.applicationName,status: task.activityName,time: task.updateTime,sourceObj: task)
  158. self.filterModels.append(model)
  159. }
  160. }
  161. //设置页码
  162. let count = JSON(val)["count"]
  163. //第一次设置总数
  164. self.currentTaskURLGenenater.pageModel.setPageTotal(count.int!)
  165. DispatchQueue.main.async {
  166. if self.searchController.isActive {
  167. self.tableView.reloadData()
  168. }
  169. }
  170. }else{
  171. DispatchQueue.main.async {
  172. DDLogError(JSON(val).description)
  173. self.showError(title: "查询失败!")
  174. }
  175. }
  176. case .failure(let err):
  177. DispatchQueue.main.async {
  178. DDLogError(err.localizedDescription)
  179. self.showError(title: "查询失败!")
  180. }
  181. }
  182. if tv.mj_header.isRefreshing(){
  183. tv.mj_header.endRefreshing()
  184. }
  185. }
  186. }
  187. func loadFilterNexdataByURL(){
  188. DDLogDebug("下一页数据 loadFilterNexdataByURL")
  189. let tv = self.tableView as! ZLBaseTableView
  190. tv.emptyTitle = self.emptyTexts[AppConfigSettings.shared.taskIndex]
  191. guard let todoTask = self.filterModels.last?.sourceObj else {
  192. DDLogError("没有最后一条数据,无法加载更多。。。。")
  193. return
  194. }
  195. self.currentTaskURLGenenater.pageModel.nextPageId = todoTask.id!
  196. AF.request(self.currentTaskURLGenenater.pagingURL(), method: .post, parameters: ["key":self.searchText], encoding: JSONEncoding.default, headers: nil).responseJSON { (response) in
  197. switch response.result {
  198. case .success(let val):
  199. let type = JSON(val)["type"]
  200. if type == "success" {
  201. let data = JSON(val)["data"]
  202. let todoTaskArray = Mapper<TodoTask>().mapArray(JSONString: data.description)
  203. if let todoTasks = todoTaskArray {
  204. for task in todoTasks {
  205. let model = TodoCellModel<TodoTask>(title: task.title,applicationName: task.applicationName,status: task.activityName,time: task.updateTime,sourceObj: task)
  206. self.filterModels.append(model)
  207. }
  208. }
  209. DispatchQueue.main.async {
  210. if self.searchController.isActive {
  211. self.tableView.reloadData()
  212. }
  213. }
  214. }else{
  215. DispatchQueue.main.async {
  216. DDLogError(JSON(val).description)
  217. self.showError(title: "查询失败!")
  218. }
  219. }
  220. case .failure(let err):
  221. DispatchQueue.main.async {
  222. DDLogError(err.localizedDescription)
  223. self.showError(title: "查询失败!")
  224. }
  225. }
  226. if tv.mj_footer.isRefreshing() {
  227. tv.mj_footer.endRefreshing()
  228. }
  229. }
  230. }
  231. //加载第一页数据
  232. func loadFirstDataByURL(){
  233. DDLogDebug("加载数据 loadFirstDataByURL")
  234. let tv = self.tableView as! ZLBaseTableView
  235. tv.emptyTitle = self.emptyTexts[AppConfigSettings.shared.taskIndex]
  236. AF.request(self.currentTaskURLGenenater.pagingURL(), method: .get, parameters: nil, encoding: JSONEncoding.default, headers: nil).responseJSON { (response) in
  237. switch response.result {
  238. case .success(let val):
  239. let type = JSON(val)["type"]
  240. if type == "success" {
  241. self.models.removeAll()
  242. let data = JSON(val)["data"]
  243. let todoTaskArray = Mapper<TodoTask>().mapArray(JSONString: data.description)
  244. if let todoTasks = todoTaskArray {
  245. for task in todoTasks {
  246. let model = TodoCellModel<TodoTask>(title: task.title,applicationName: task.applicationName,status: task.activityName,time: task.updateTime,sourceObj: task)
  247. self.models.append(model)
  248. }
  249. }
  250. //设置页码
  251. let count = JSON(val)["count"]
  252. //第一次设置总数
  253. self.currentTaskURLGenenater.pageModel.setPageTotal(count.int!)
  254. DispatchQueue.main.async {
  255. if !self.searchController.isActive {
  256. self.tableView.reloadData()
  257. }
  258. }
  259. }else{
  260. DispatchQueue.main.async {
  261. DDLogError(JSON(val).description)
  262. self.showError(title: "查询失败!")
  263. }
  264. }
  265. case .failure(let err):
  266. DispatchQueue.main.async {
  267. DDLogError(err.localizedDescription)
  268. self.showError(title: "查询失败!")
  269. }
  270. }
  271. if tv.mj_header.isRefreshing(){
  272. tv.mj_header.endRefreshing()
  273. }
  274. }
  275. }
  276. //加载下一页数据
  277. func loadDataNextByURL() {
  278. let tv = self.tableView as! ZLBaseTableView
  279. tv.emptyTitle = self.emptyTexts[AppConfigSettings.shared.taskIndex]
  280. let todoTask = self.models.last?.sourceObj!
  281. self.currentTaskURLGenenater.pageModel.nextPageId = (todoTask?.id)!
  282. AF.request(self.currentTaskURLGenenater.pagingURL(), method: .get, parameters: nil, encoding: JSONEncoding.default, headers: nil).responseJSON { (response) in
  283. switch response.result {
  284. case .success(let val):
  285. let type = JSON(val)["type"]
  286. if type == "success" {
  287. let data = JSON(val)["data"]
  288. let todoTaskArray = Mapper<TodoTask>().mapArray(JSONString: data.description)
  289. if let todoTasks = todoTaskArray {
  290. for task in todoTasks {
  291. let model = TodoCellModel<TodoTask>(title: task.title,applicationName: task.applicationName,status: task.activityName,time: task.updateTime,sourceObj: task)
  292. self.models.append(model)
  293. }
  294. }
  295. DispatchQueue.main.async {
  296. if !self.searchController.isActive {
  297. self.tableView.reloadData()
  298. }
  299. }
  300. }else{
  301. DispatchQueue.main.async {
  302. DDLogError(JSON(val).description)
  303. self.showError(title: "查询失败!")
  304. }
  305. }
  306. case .failure(let err):
  307. DispatchQueue.main.async {
  308. DDLogError(err.localizedDescription)
  309. self.showError(title: "查询失败!")
  310. }
  311. }
  312. if tv.mj_footer.isRefreshing() {
  313. tv.mj_footer.endRefreshing()
  314. }
  315. }
  316. }
  317. //初始化控件
  318. func initSegmentedControl(){
  319. let titleStrings = ["待办", "待阅", "已办", "已阅"]
  320. let titles: [NSAttributedString] = {
  321. let attributes = [NSAttributedString.Key.font: UIFont(name: "PingFangSC-Regular", size: 17.0)!
  322. , NSAttributedString.Key.foregroundColor: UIColor.white]
  323. var titles = [NSAttributedString]()
  324. for titleString in titleStrings {
  325. let title = NSAttributedString(string: titleString, attributes: attributes)
  326. titles.append(title)
  327. }
  328. return titles
  329. }()
  330. let selectedTitles: [NSAttributedString] = {
  331. let attributes = [NSAttributedString.Key.font: UIFont(name: "PingFangSC-Regular", size: 17.0)!, NSAttributedString.Key.foregroundColor: UIColor.darkGray]
  332. var selectedTitles = [NSAttributedString]()
  333. for titleString in titleStrings {
  334. let selectedTitle = NSAttributedString(string: titleString, attributes: attributes)
  335. selectedTitles.append(selectedTitle)
  336. }
  337. return selectedTitles
  338. }()
  339. segmentedControl = SegmentedControl.initWithTitles(titles, selectedTitles: selectedTitles)
  340. segmentedControl.delegate = self
  341. segmentedControl.backgroundColor = UIColor.clear
  342. segmentedControl.selectionBoxColor = UIColor.white
  343. segmentedControl.selectionBoxStyle = .default
  344. segmentedControl.selectionBoxCornerRadius = 15
  345. segmentedControl.frame.size = CGSize(width: 70 * titles.count, height: 30)
  346. segmentedControl.isLongPressEnabled = true
  347. segmentedControl.isUnselectedSegmentsLongPressEnabled = true
  348. segmentedControl.longPressMinimumPressDuration = 1
  349. //segmentedControl.setTitleAttachedIcons([#imageLiteral(resourceName: "taskSegmentAdditionIcon")], selectedTitleAttachedIcons: [#imageLiteral(resourceName: "taskSegmentAdditionIconSelected")])
  350. navigationItem.titleView = segmentedControl
  351. segmentedControl.setSelected(at: AppConfigSettings.shared.taskIndex, animated: true)
  352. }
  353. // MARK: - Table view data source
  354. override func numberOfSections(in tableView: UITableView) -> Int {
  355. return 1
  356. }
  357. override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  358. if !self.searchController.isActive {
  359. return self.models.count
  360. }else{
  361. return self.filterModels.count
  362. }
  363. }
  364. override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  365. let cell = tableView.dequeueReusableCell(withIdentifier: "TodoTaskTableViewCell", for: indexPath) as! TodoTaskTableViewCell
  366. if !self.searchController.isActive {
  367. let model = self.models[indexPath.row]
  368. cell.setData(cellModel: model)
  369. }else{
  370. let model = self.filterModels[indexPath.row]
  371. cell.setData(cellModel: model)
  372. }
  373. return cell
  374. }
  375. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  376. // self.performSegue(withIdentifier: "toSignature", sender: nil)
  377. var todoTask:TodoTask?
  378. if !self.searchController.isActive {
  379. todoTask = self.models[indexPath.row].sourceObj
  380. }else{
  381. todoTask = self.filterModels[indexPath.row].sourceObj
  382. }
  383. //根据不同的类型跳转显示
  384. switch self.segmentedControl.selectedIndex {
  385. case 0:
  386. self.performSegue(withIdentifier: "showTodoDetailSegue", sender: todoTask)
  387. case 1:
  388. self.performSegue(withIdentifier: "showTodoDetailSegue", sender: todoTask)
  389. case 2:
  390. self.performSegue(withIdentifier: "showTodoedDetailSegue", sender: todoTask)
  391. case 3:
  392. self.performSegue(withIdentifier: "showTodoDetailSegue", sender: todoTask)
  393. default:
  394. DDLogDebug("no click")
  395. }
  396. }
  397. override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
  398. return UIView()
  399. }
  400. //prepare
  401. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  402. if segue.identifier == "showTodoDetailSegue" {
  403. let destVC = segue.destination as! TodoTaskDetailViewController
  404. destVC.todoTask = sender as? TodoTask
  405. destVC.backFlag = 2 //返回标志
  406. }else if segue.identifier == "showTodoedDetailSegue" {
  407. let destVC = segue.destination as! TodoedTaskViewController
  408. destVC.todoTask = sender as? TodoTask
  409. }else if segue.identifier == "toSignature" {
  410. DDLogDebug("签名去了。。。。。。。。。")
  411. }
  412. }
  413. //backWindtodoTask
  414. @IBAction func unWindForTodoTask(_ segue:UIStoryboardSegue){
  415. DDLogDebug(segue.identifier!)
  416. self.tableView.mj_header.beginRefreshing()
  417. // if segue.identifier == "backToTodoTask" {
  418. // self.segmentedControl.setSelected(at: 0, animated: true)
  419. // AppConfigSettings.shared.taskIndex = 0
  420. // self.tableView.mj_header.beginRefreshing()
  421. //self.segmentedSelected(self.taskSegmentedControl)
  422. // }else if segue.identifier == "backToReadTask" {
  423. // self.segmentedControl.setSelected(at: 1, animated: true)
  424. // AppConfigSettings.shared.taskIndex = 1
  425. // self.tableView.mj_header.beginRefreshing()
  426. // }
  427. }
  428. }
  429. //searcher update
  430. extension TodoTaskViewController:UISearchResultsUpdating,UISearchControllerDelegate{
  431. func willPresentSearchController(_ searchController: UISearchController) {
  432. DDLogDebug("willPresentSearchController 1, searchController.isActive = \(searchController.isActive)")
  433. self.models.removeAll()
  434. self.tableView.reloadData()
  435. }
  436. func didPresentSearchController(_ searchController: UISearchController) {
  437. DDLogDebug(" didPresentSearchController 2, searchController.isActive = \(searchController.isActive)")
  438. }
  439. func willDismissSearchController(_ searchController: UISearchController) {
  440. DDLogDebug(" didPresentSearchController 3, searchController.isActive = \(searchController.isActive)")
  441. }
  442. func didDismissSearchController(_ searchController: UISearchController) {
  443. DDLogDebug(" didDismissSearchController 4, searchController.isActive = \(searchController.isActive)")
  444. //self.tableView.mj_header.beginRefreshing()
  445. }
  446. func updateSearchResults(for searchController: UISearchController) {
  447. DDLogDebug("updateSearchResults........")
  448. if let sText = searchController.searchBar.text {
  449. self.searchText = sText
  450. self.headerLoadData()
  451. }else {
  452. DDLogDebug("search text is nil ..................")
  453. }
  454. }
  455. }
  456. extension TodoTaskViewController:SegmentedControlDelegate{
  457. func segmentedControl(_ segmentedControl: SegmentedControl, didSelectIndex selectedIndex: Int) {
  458. DDLogDebug("click \(selectedIndex)")
  459. AppConfigSettings.shared.taskIndex = selectedIndex
  460. self.setSearchBarIsShow()
  461. self.headerLoadData()
  462. //self.tableView.mj_header.beginRefreshing()
  463. }
  464. func segmentedControl(_ segmentedControl: SegmentedControl, didLongPressIndex longPressIndex: Int) {
  465. }
  466. }