Convert NSInteger to NSUInteger?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to convert a NSInteger to a NSUInteger and I googled it and found no real answer. How would I do this? 回答1: NSInteger and NSUInteger are just typedefs for primitive integer types: #if __LP64__ || NS_BUILD_32_LIKE_64 typedef long NSInteger ; typedef unsigned long NSUInteger ; #else typedef int NSInteger ; typedef unsigned int NSUInteger ; #endif As such, you don't need to "convert" between them. A simple cast should be sufficient. Like: NSInteger myInt = 0 ; NSUInteger unsignedInt = ( NSUInteger ) myInt ; 回答2: Since this