问题标签 [nsuinteger]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
24927 浏览

objective-c - 如何将 NSUInteger 转换为 NSString?

你如何将一个转换NSUInteger成一个NSString?我已经尝试过,但我一直NSString返回 0。

0 投票
2 回答
485 浏览

iphone - 在 NSDictionary 中插入 NSURL 或整数

我有一个班级'book.h',我在其中声明了

书.h

BookDetailview.h

BookDetailView.m

图像单元.m

0 投票
1 回答
394 浏览

objective-c - cellForRowAtIndexPath(需要在indexpath中使用一个字符串和一个整数值)

亲爱的,我想在一个 tableView 中显示两个不同的数组。我将“years”数组声明为字符串,将“amount”数组声明为整数。年金额,例如:2012、2013 .... 155888、151768 当我 build7run 应用程序时,结果如下:(看起来它减少了 16 个数字)

2012:80912864
2013:79047056
2014:79046640
2015:79046640
2016:79051632
...
2020:80928544

“year”数组作为字符串工作,但作为“amount”的整数数组没有。我很确定我在cell.text= 行中使用整数格式做错了。如果你能帮助解决这个问题,我会很高兴提前谢谢

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

[NSNumber numberWithInt:[amount objectAtIndex:row]]];

}

0 投票
1 回答
2621 浏览

objective-c - 从 sqlite3 db 中检索整数值(obj-c 中的问题)

在 sqlite3 数据库中,我有一个包含两个字段的表“数据”:类型和路径。字段类型定义为 INTEGER。在此字段中,我插入一个 NSUInteger 值(例如 0 或 1)。问题是,当我检索它时,我获得了一个“奇怪”的值。我不知道我哪里错了。

0 投票
3 回答
4878 浏览

objective-c - NSIntegerMax 与 NSUIntegerMax

为什么?我想作为 indexOfObject 的结果得到一个无符号值。所以,自然地,我假设如果找不到对象,它将返回 NSUIntegerMax 而不是 NSIntegerMax。这是一个错误,还是对此行为有合理的解释。

0 投票
4 回答
25803 浏览

objective-c - 将 NSInteger 转换为 NSUInteger?

我正在尝试将 NSInteger 转换为 NSUInteger 并且我用谷歌搜索并没有找到真正的答案。我该怎么做?

0 投票
2 回答
21676 浏览

iphone - int、NSInteger 和 NSUInteger 的区别

和在Objective-C中int的主要区别是什么?NSIntegerNSUInteger

哪一个更适合在应用程序中使用,为什么?

0 投票
1 回答
2106 浏览

cocoa - NSUInteger 到 int

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

编译器说:

为什么?

0 投票
2 回答
40066 浏览

core-data - 我应该使用 Core Data 中的 NSNumber (Integer 16, 32, 64) 来保留 NSUInteger

我想将 NSUInteger 保留在我的核心数据中,但我不知道应该使用哪种类型(整数 16、32、64)来适应所需的空间。

据我了解:

并且 NSUInteger 是 unsigned long 类型的 def ,它等于 unsigned int (iPhone 上的 Objective-c 类型

所以如果我使用 numberWithUnsignedInteger: 将我的 NSUInteger 转换为 NSNumber 并将其保存为 NSNumber(Integer 32) 我可以安全地检索我的数据吗?

0 投票
1 回答
284 浏览

objective-c - 预期 unsigned int 时返回 unsigned long 的后果

我正在-hash一个类上实现该方法,它应该返回一个NSUInteger. 我的实现将与此类似:

现在,CFHash返回 a CFHashCode,它是typedefed unsigned long,但据我所知 anNSUInteger要么是unsigned longOR an unsigned int

如果我unsigned long在应用程序期望一个时返回一个,我会遇到什么样的问题unsigned int