如果已经不在本页了, 不要设置内容, alert

This commit is contained in:
life
2015-11-02 18:52:38 +08:00
parent 62e1754c6d
commit 4ede2afa23
5 changed files with 21 additions and 7 deletions

View File

@@ -38,7 +38,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>949</string>
<string>950</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View File

@@ -18,7 +18,7 @@
<key>AutocorrectionType</key>
<string>No</string>
<key>DefaultValue</key>
<string>1.0 (949)</string>
<string>1.0 (950)</string>
<key>IsSecure</key>
<false/>
<key>Key</key>

View File

@@ -86,6 +86,7 @@ static NSInteger const MaximumNumberOfPictures = 10;
@property (nonatomic) BOOL isMarkdown;
@property (nonatomic) BOOL edited;
@property (nonatomic) BOOL isClosed;
@property BOOL isInited;
@@ -222,7 +223,7 @@ static NSInteger const MaximumNumberOfPictures = 10;
// loading
[self hideProgress];
self.isClosed = YES;
[super viewWillDisappear:animated];
}
@@ -405,13 +406,26 @@ BOOL hiddenBar = NO;
[self showProgress];
[Leas.note getNoteContent:self.note success:^(NSString * content) {
//
if(self.isClosed) {
return;
}
[self setBodyText:content];
[self enableRightButtons];
[self hideProgress];
} fail:^{
// , alert
if(self.isClosed) {
return;
}
[self hideProgress];
[LeaAlert showAlertWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"Cannot fetch note's content", nil) withSupportButton:NO okPressedBlock:^(UIAlertView *alertView) {
[LeaAlert showAlertWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"Cannot fetch note's content", nil) withSupportButton:NO okPressedBlock:^() {
if(self.isClosed) {
return;
}
//
// ,
[self.navigationController popViewControllerAnimated:YES];
}];
}];

View File

@@ -64,7 +64,7 @@
@param okPressedBlock a block to execute if the OK button is pressed
*/
+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message
withSupportButton:(BOOL)showSupport okPressedBlock:(void (^)(UIAlertView *alertView))okBlock;
withSupportButton:(BOOL)showSupport okPressedBlock:(void (^)())okBlock;
@end

View File

@@ -31,7 +31,7 @@ NSInteger const SupportButtonIndex = 0;
else if([title isEqualToString:NSLocalizedString(@"OK", nil)])
{
if(self.okPressedBlock) {
self.okPressedBlock();
self.okPressedBlock(nil);
self.okPressedBlock = nil;
}
}
@@ -52,7 +52,7 @@ NSInteger const SupportButtonIndex = 0;
[self showAlertWithTitle:title message:message withSupportButton:showSupport okPressedBlock:nil];
}
+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message withSupportButton:(BOOL)showSupport okPressedBlock:(void (^)(UIAlertView *))okBlock
+ (void)showAlertWithTitle:(NSString *)title message:(NSString *)message withSupportButton:(BOOL)showSupport okPressedBlock:(void (^)()) okBlock
{
if ([LeaAlert internalInstance].alertShowing) {
return;