iphone - 如何在 iPhone 应用程序中声明全局 int

标签 iphone objective-c xcode

我正在 iPhone 应用程序中创建一个全局 int 变量,但它给出了错误。

我这样声明:

 AppDelegate.h

 int maxglobal;

当我将其分配给任何其他值时,它表示对象无法设置为其他类中的属性。

最佳答案

Objective-C :

@property (assign) int maxglobal; // define this in app delegate

C:

int maxglobal; // define this outside any class and it's "global"

关于iphone - 如何在 iPhone 应用程序中声明全局 int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10731639/

相关文章:

iphone - iphone 上的内联 html5 视频

iphone - 如何使用 Core Data 在 UITextfield 中设置整数?

iphone - 在 iOS 中从 Facebook 获取用户详细信息

iphone - 如何确定正在编辑 UITableView 中的哪个节标题

ios - UIView subview 自动布局问题

ios - 有什么办法可以折叠 Xcode 项目中的所有方法吗?

ios - 键盘打开时移动 View 的问题

ios - Push segue 隐藏导航栏

iphone - 如何对 iOS 应用程序使用的服务器进行负载测试?

objective-c - cocoa 按钮不会显示图像