Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1254605

Browse files
公告编辑文本点击返回,添加保存提醒
1 parent 721bb7d commit 1254605

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎Coding_iOS/Controllers/ProjectTweetSendViewController.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import "WebContentManager.h"
1212
#import "EaseMarkdownTextView.h"
1313
#import "WebViewController.h"
14+
#import "UIViewController+BackButtonHandler.h"
1415

1516

1617
@interface ProjectTweetSendViewController ()<UIWebViewDelegate>
@@ -72,6 +73,21 @@ - (void)viewDidAppear:(BOOL)animated{
7273
}
7374
}
7475

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+
7591
#pragma mark UISegmentedControl
7692
- (void)segmentedControlSelected:(id)sender{
7793
UISegmentedControl *segmentedControl = (UISegmentedControl *)sender;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /