| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- jface
- boot
- elasticsearch
- 백준
- 후기
- 자바스크립트
- Spring
- effective
- 스프링
- RCP
- 알고리즘
- Spring Boot
- MySQL
- 이펙티브
- javascript
- 엘라스틱서치
- 맛집
- java8
- java
- kibana
- 인터페이스
- 리뷰
- JPA
- 자바
- Git
- nodejs
- 독후감
- node
- error
- Web
Archives
- Today
- Total
wedul
뒤로가기 버튼 차단 본문
반응형
앱의 비밀번호 입력 페이지등을 만들다 보면
뒤로가기 버튼을 막아야 하는 경우가 있다.
이 경우 platform에서 제공하는 뒤로가기 버튼 Action을
재정의하여 차단한다.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | // Property used to store the callback of the event handler to unsubscribe to it when leaving this page public unregisterBackButtonAction: any; constructor(...) { ... } ionViewDidEnter() { this.initializeBackButtonCustomHandler(); } ionViewWillLeave() { // Unregister the custom back button action for this page this.unregisterBackButtonAction && this.unregisterBackButtonAction(); } public initializeBackButtonCustomHandler(): void { this.unregisterBackButtonAction = this.platform.registerBackButtonAction(() => { this.customHandleBackButton(); }, 10); } private customHandleBackButton(): void { // do what you need to do here ... } // Property used to store the callback of the event handler to unsubscribe to it when leaving this page public unregisterBackButtonAction: any; constructor(...) { ... } ionViewDidEnter() { this.initializeBackButtonCustomHandler(); } ionViewWillLeave() { // Unregister the custom back button action for this page this.unregisterBackButtonAction && this.unregisterBackButtonAction(); } public initializeBackButtonCustomHandler(): void { this.unregisterBackButtonAction = this.platform.registerBackButtonAction(() => { this.customHandleBackButton(); }, 10); } private customHandleBackButton(): void { // 뒤로가기 버튼 Action 재 정의 } | cs |
반응형
