Open
Description
Dear,
There is a bug after invoking [youCXAlertView dismiss], please see the detail below.
In the screenshot, you could see that there is still a CXAlertView on the top layer
receiving all touch events after invoking [youCXAlertView dismiss], which hangs up the app just like blocking the main-thread.
Revision:
My revision is 2014/03/28, downloaded from git repo directly.
Reproduce steps:
- press OK to login. The CXAlertView doesn't execute [cxAlertView dismiss] because giving by a wrong password.
- press Cancel.
Here is my code:
- (void)showLoginDialog:(NASServer *)targetNAS withResultBlock:(void(^)(BOOL success, NSError *e))loginResult{
NSString *bundleName = @"ASViewController";
ASViewController *loginViewController =[[[NSBundle mainBundle] loadNibNamed:bundleName
owner:self
options:nil] objectAtIndex:0];
loginViewController.loginResultBlock = loginResult;
loginViewController.targetNASServer = targetNAS;
[CXAlertView showContentViewAlert:NSLocalizedString(@"PwdConfirm", nil)
withActionTitle:NSLocalizedString(@"OK", nil)
withContentView:loginViewController
withActionHandler:^(CXAlertView *alert, CXAlertButtonItem *btn){
QNVideoStationAPIManager *videoStation = [QNAPCommunicationManager share].videoStationManager;
[videoStation authLogin:loginViewController.usernameField.text
withPassword:loginViewController.passwordField.text
withSuccessBlock:^(RKObjectRequestOperation *o, RKMappingResult *r){
[alert dismiss];
loginResult(YES, nil);
}
withFailureBlock:^(RKObjectRequestOperation *o, NSError *error){
loginResult(NO, error);
}];
}];
}
+ (CXAlertView *)showContentViewAlert:(NSString *)title withActionTitle:(NSString *)actionTitle withContentView:(UIView *)contentView withActionHandler:(void(^)(CXAlertView *alert, CXAlertButtonItem *btn))cxHandler{
CXAlertView *alert = [[CXAlertView alloc] initWithTitle:title
contentView:contentView
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)];
if (actionTitle != nil) {
[alert addButtonWithTitle:actionTitle
type:CXAlertViewButtonTypeCustom
handler:^(CXAlertView *_alert, CXAlertButtonItem *btn){
cxHandler(_alert, btn);
}];
}
alert.cancelButtonFont = [UIFont systemFontOfSize:18.0f];
alert.customButtonFont = [UIFont boldSystemFontOfSize:18.0f];
alert.cancelButtonColor = [UIColor colorWithHexString:@"007aff" alpha:1.0f];
alert.customButtonColor = [UIColor colorWithHexString:@"007aff" alpha:1.0f];
[alert show];
alert.showBlurBackground = NO;
return alert;
}
Metadata
Assignees
Labels
No labels
Activity