当前位置: 代码迷 >> 综合 >> alertView otherButtonTitles:@“”,@“”崩溃 空格
  详细解决方案

alertView otherButtonTitles:@“”,@“”崩溃 空格

热度:28   发布时间:2023-12-15 02:32:20.0


- (id)initWithTitle:(NSString*)title params:(NSMutableDictionary*)params

{

    self.params = params;

    if(self){

    if (self= [superinitWithTitle:title message:@""delegate:selfcancelButtonTitle:@"关闭"otherButtonTitles:@“”,@“”,nil]){

        [selfaddButtonWithTitle:CASH_QUERY_MODIFY_BTN];

        [selfaddButtonWithTitle:CASH_QUERY_CANCE_BTN];

        self.delegate =self;

    }

    }

    return self;

}


将红色部分修改为:if (self= [super initWithTitle:title message:@"" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:@“ ”,@“ ”,nil]) 


或者if (self= [super initWithTitle:title message:@"" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:,nil]) 




- (id)initWithTitle:(NSString*)title params:(NSMutableDictionary*)params

{

    self.params = params;

    if (self= [super initWithTitle:title message:@"" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:nil]) {

        [self addButtonWithTitle:CASH_QUERY_MODIFY_BTN];

        [self addButtonWithTitle:CASH_QUERY_CANCE_BTN];

        self.delegate = self;

    }

    return self;

}


- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{

    if(buttonIndex == 1){

        HsCommonPage *page = [HsComponentFactory createAndRegComponent:@"cashModifyPage"

                                                             withParam:_params

                                                                    ID:@"cashModifyPage"];

        

        [[HsViewController sharedManager] addPageToTop:page];

    }

    else if(buttonIndex == 2){

        [[HsSearchPageSupport sharedManager] askConfirmToProductCancel:_params];

    }

    else{

        return;

    }

}