小编the*_*epp的帖子

objective-c - 全局变量

如何在main.m文件中声明变量以使其在所有类中都可用?

如果我只是在main函数中声明它,编译器说它在类方法中未声明.

我必须在这样的对象中声明它吗?

@public
type variable;
Run Code Online (Sandbox Code Playgroud)

variables global

12
推荐指数
2
解决办法
3万
查看次数

NSUInteger到int

我写了一个使用myarray的方法,在同一个类中定义.当我使用count时它总是返回0.当我使用:

printf("%d", [myarray count]);
Run Code Online (Sandbox Code Playgroud)

编译说:

Format '%d' expetcs type 'int', but argument 2 has type 'NSUInteger'
Run Code Online (Sandbox Code Playgroud)

为什么?

cocoa printf nsuinteger

2
推荐指数
1
解决办法
2104
查看次数

标签 统计

cocoa ×1

global ×1

nsuinteger ×1

printf ×1

variables ×1