您的位置:首页 > 编程语言

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

2012-12-25 16:26 239 查看
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]; \
    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: