【发布时间】:2014-10-18 06:41:49
【问题描述】:
惊喜!
我有一个这样的变量,
NSInteger index = 0;
我将它与这样的子视图计数之一(返回NSUInteger)进行比较,
if((index-1) <= [[currentmonth subviews] count])
{
NSLog(@"true");
}
else
{
NSLog(@"false");
}
这总是假的。
但如果我这样做,
if ((index-1) <= 42) {
NSLog(@"true");
} else {
NSLog(@"false");
}
这总是真实的。
我觉得,这是因为我们无法将NSInteger 与NSUInteger 进行比较,对吗?
当我有一个基于此逻辑的可行解决方案时,我发现了这个问题。 但事实并非如此。
【问题讨论】:
标签: ios objective-c comparison nsinteger nsuinteger