#define Showalert (format, ...) Myshowalert (__line__, (char *) __function__, format, # #__VA_ARGS__)#ifdef DEBUG #define DLog (format,...) NSLog (@ "DLog%s-[line%d]%s\n\n" format), __pretty_function__,__line__, __function__,# #__VA_ARGS__)#else #define DLog (format,...) does {} while (0)#endif
voidMyshowalert (intLineChar*functname,IDformatstring,...) {va_list arglist; if(!formatstring) { return; } va_start (arglist, formatstring); IDOutstring =[[NSString alloc] initwithformat:formatstring arguments:arglist]; Va_end (arglist); NSString*filename =[[NSString stringwithcstring:__file__ encoding:nsutf8stringencoding] lastpathcomponent]; NSString*defuginfo = [NSString stringWithFormat:@"file=%@ line=%d\n%s", Filename,line,functname]; Uialertview*alert = [[Uialertview alloc] initwithtitle:outstring message:defuginfoDelegate: Nil Cancelbuttontitle:@"OK"Otherbuttontitles:nil, nil]; [Alert show]; }
Define implementation Showalert