zoukankan      html  css  js  c++  java
  • 在子线程中显示提示信息框的公共方法

    #pragma mark - 在子线程中显示提示信息框
    
    //在子线程中显示提示信息框
    -(void)showAlertwithTitle:(NSString *)title message:(NSString *)msg cancleButtonTitle:(NSString *) cancleTitle otherButtonTitle:(NSString *)otherButtonTitle tag:(NSString *)tag
    {
        NSArray *array = [NSArray arrayWithObjects:title,msg,cancleTitle,otherButtonTitle,tag, nil];
        [self performSelectorOnMainThread:@selector(doAlert:) withObject:array waitUntilDone:NO];   //回归主线程
    }
    
    //弹出信息显示框
    -(void)doAlert:(NSArray *)array
    {
        NSString *title = nil;
        if (![[array objectAtIndex:0] length]==0) title = [array objectAtIndex:0];
    
        NSString *msg = nil;
        if (![[array objectAtIndex:1] length]==0) msg = [array objectAtIndex:1];
    
        
        NSString *cancleTitle = nil;
        if (![[array objectAtIndex:2] length]==0) cancleTitle = [array objectAtIndex:2];
        
        NSString *otherButtonTitle = nil;
        if (![[array objectAtIndex:3] length]==0) otherButtonTitle = [array objectAtIndex:3];
    
        
        NSString *tag = @"0";
        if (![[array objectAtIndex:4] length]==0) tag = [array objectAtIndex:4];
    
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:cancleTitle otherButtonTitles:otherButtonTitle,nil];
        alert.tag = [tag integerValue];
        [alert show];
        [alert release];
    }
  • 相关阅读:
    算法提高 约数个数
    算法提高 第二大整数
    算法提高 逆序排列
    算法提高 c++_ch02_01
    算法提高 日期计算
    程序员教你设置密码
    fzu 2184 逆序数还原
    fzu 2146 Easy Game
    算法训练 区间k大数查询
    算法训练 最大最小公倍数
  • 原文地址:https://www.cnblogs.com/ygm900/p/3491367.html
Copyright © 2011-2022 走看看