关于随机参数... 的几个代码段

void ShowInfo( id formatstring,...)

{

    va_list arglist;

if (!formatstring) return;

va_start(arglist, formatstring);

id outstring = [[[NSStringalloc]initWithFormat:formatstringarguments:arglist]autorelease];

va_end(arglist);

   [ [HFInfoView sharedInstance]showInfo: outstring];

}


# define NSLog(formatstr,...)  {\

NSString *outstring = [NSString stringWithFormat:(formatstr),##__VA_ARGS__];\

printf([outstring UTF8String]);\

}


#define HFAlert(fmt, ...) \

    {\

      UIAlertView *alert1 = [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:fmt,##__VA_ARGS__] delegate:nil cancelButtonTitle:@"确认" otherButtonTitles:nil] autorelease];\

        [alert1 show]; \

    }


你可能感兴趣的:(代码段,object-c)