티스토리 뷰
728x90
반응형
UITalbeViewCell SwipeAction
UITableViewDatasource - trailingSwipeActionConfigurationForRowAt
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
//info
let info = UIContextualAction(style: .normal, title: "세부사항") { action, view, completion in
//세부사항을 클릭하면 모달창을 띄우게 함.
guard let nextVC = self.storyboard?.instantiateViewController(identifier: DetailReminderVC.identifier) as? DetailReminderVC else {
return
}
//modally
self.present(nextVC, animated: true, completion: nil)
}
//delete
let delete = UIContextualAction(style: .destructive, title: "삭제") { action, view, completion in
//tableContents 라는 배열에 정보를 저장했다.
self.tableContents.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .automatic)
}
return UISwipeActionsConfiguration(actions: [delete, info])
}728x90
반응형
'iOS' 카테고리의 다른 글
| iOS) UITextField 에 입력시 키보드 위 toolbar 구현 (0) | 2021.07.21 |
|---|---|
| iOS) UITalbeView editing mode 에서 multiple selection 구현 (0) | 2021.07.21 |
| iOS) UITalbeView Separator 없애기 (0) | 2021.07.20 |
| iOS) UITextView placeholder 효과 구현하기 (0) | 2021.07.20 |
| iOS) section 에 따라서 커스텀 셀 설정 (0) | 2021.07.20 |
댓글
TAG
- watchOS
- Firebase
- github
- Notification
- YPImagePicker
- SwiftUI
- Widget
- 서버통신
- WWDC
- MVVM
- Protocol
- APNS
- OpenSourceLibrary
- configurable widget
- rxswift
- WWDC22
- Algorithm
- containerBackground
- RxCocoa
- CloneCoding
- 2022 KAKAO TECH INTERNSHIP
- WidgetKit
- IOS
- MOYA
- Swift
- urlsession
- Objective-C
- UserDefaults
- async/await
- projectsetting
최근에 올라온 글
최근에 달린 댓글
글 보관함
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
링크
- Total
- Today
- Yesterday