|
11 | 11 | #import "WebContentManager.h"
|
12 | 12 | #import "EaseMarkdownTextView.h"
|
13 | 13 | #import "WebViewController.h"
|
| 14 | +#import "UIViewController+BackButtonHandler.h" |
14 | 15 |
|
15 | 16 |
|
16 | 17 | @interface ProjectTweetSendViewController ()<UIWebViewDelegate>
|
@@ -72,6 +73,21 @@ - (void)viewDidAppear:(BOOL)animated{
|
72 | 73 | }
|
73 | 74 | }
|
74 | 75 |
|
| 76 | +- (BOOL)navigationShouldPopOnBackButton{ |
| 77 | + BOOL hasChanged = ![self.curTweet.raw ?: @"" isEqualToString:_editView.text]; |
| 78 | + if (hasChanged) { |
| 79 | + __weak typeof(self) weakSelf = self; |
| 80 | + [[UIAlertController ea_alertViewWithTitle:@"提示" message:@"如果不保存,更改将丢失,是否确认返回?" buttonTitles:@[@"确认返回"] destructiveTitle:nil cancelTitle:@"取消" andDidDismissBlock:^(UIAlertAction *action, NSInteger index) { |
| 81 | + if (index == 0) { |
| 82 | + [weakSelf.navigationController popViewControllerAnimated:YES]; |
| 83 | + } |
| 84 | + }] show]; |
| 85 | + return NO; |
| 86 | + }else{ |
| 87 | + return YES; |
| 88 | + } |
| 89 | +} |
| 90 | + |
75 | 91 | #pragma mark UISegmentedControl
|
76 | 92 | - (void)segmentedControlSelected:(id)sender{
|
77 | 93 | UISegmentedControl *segmentedControl = (UISegmentedControl *)sender;
|
|
0 commit comments