开发者

how can i pass the constant value made by the keyword #define to a method as a parameter?

I have defined a constant in my some file and added in file where i wanna use it as shown below.


#define myMapID 1

But the problem is when i passed开发者_如何学Python the value to a method as a parameter, the compiler gives warning, and yes it must do but how can i avoid warnings ?


-(void) methodName :(int) mapId
{
//printID
}

[self methodName :myMapID];


Just use a (global) static/constant int, much clearer than #define and won't give a warning.


Odd that it would give you a warning on that. try:

#define myMapID (int) 1

maybe?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜