ios - Objective C 整数数组

标签 ios objective-c arrays object integer

<分区>

我有一个名为binaryArray的数组。

使用 NSMutableArray *binaryArray = [[NSMutableArray alloc] init]; 初始化;

我使用 [binaryArray addObject:[NSNumber numberWithInt:1]]; 将 0 或 1 添加到数组中

然后我在 tableView 中引用这个数组

id resultBinary = [binaryArray objectAtIndex:indexPath.item];

    if (resultBinary == 0) {
        ...
    } else {
        ...
    }

但是,即使 resultBinary0,它也永远不会命中

最佳答案

试试这个

if ([resultBinary integerValue] == 0) {
    ...
} else {
    ...
}

关于ios - Objective C 整数数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48117460/

上一篇:ios - 如何关闭 iOS 相机访问弹出窗口?

下一篇:ios - 获得 FCM token 后 APNS token 是否仍然有效

相关文章:

ios - 使用视频播放器时应用程序总是崩溃

android - Bootstrap 3 在移动设备上添加右边距(?)

ios - 我没有使用任何启动图像警告问题

iphone - UIActivityViewController 发送 html 邮件 ios6

ruby-on-rails - rails : Averaging an array of time

ios - Segue 到 tableview Controller,传递数据

ios - 选择表行时如何从原型(prototype) UITableViewCell 获取控件?

ios - 带有多个按钮的导航栏

arrays - Node.js 写入现有地理位置 JSON 错误

javascript - VueJS splice 删除数组中的所有项目