zoukankan      html  css  js  c++  java
  • define实现ShowAlert

    #define ShowAlert(format, ...) myShowAlert(__LINE__, (char *)__FUNCTION__, format, ##__VA_ARGS__)
    
    #ifdef DEBUG
    #define DLog(format,...) NSLog((@"DLog %s - [Line %d] %s
    
    " format), __PRETTY_FUNCTION__,__LINE__, __FUNCTION__,##__VA_ARGS__)
    #else
    #define DLog(format,...) do {} while(0)
    #endif
    void myShowAlert(int line, char *functName, id formatstring,...){
        va_list arglist;
        if (!formatstring) {
            return;
        }
        va_start(arglist, formatstring);
        id outString = [[NSString alloc] initWithFormat:formatstring arguments:arglist];
        va_end(arglist);
        
        NSString *fileName = [[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent];
        
        NSString *defugInfo = [NSString stringWithFormat:@"file=%@ line=%d
    %s",fileName,line,functName];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:outString message:defugInfo delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
        [alert show];
        
    }
  • 相关阅读:
    CCF_ 201403-2_窗口
    CCF_201503-2_数字排序
    [loj3346]交换城市
    [cf516E]Drazil and His Happy Friends
    [cf505E]Mr. Kitayuta vs. Bamboos
    [loj3343]超现实树
    [loj3331]选课
    [loj3342]制作菜品
    [loj3156]回家路线
    [loj3339]美食家
  • 原文地址:https://www.cnblogs.com/xiaochaozi/p/4135087.html
Copyright © 2011-2022 走看看