我试图将didSelectRowAtIndexPath委托方法中的索引路径与索引路径数组进行比较。
for (n=0; n < [tempMutArrray count]; n= n+1){
NSComparisonResult *result = [indexPath compare:[tempMutArray objectAtIndex:n];
//What I want to do is is write an if statement that executes a certain block of code
//if the two index paths are equal, but I cant figure out how to work with an
//NSComparisonResult.
}
答案 0 :(得分:1)
使用NSOrderedSame
而没有指针 - NSComparisonResult
只是一个整数:
NSComparisonResult result = [indexPath compare:[tempMutArray objectAtIndex:n];
if(result == NSOrderedSame) {
// do stuff
}
在Cocoa API中,有一些非类型正在使用中。最重要的是来自Foundation data types的内容,其中包括
答案 1 :(得分:1)
这只是一个包含其中一个值的int:
在您的情况下,请测试NSOrderedSame
:
if (result == NSOrderedSame) {
...
}