循环比较indexPaths iphone
我试图将 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.
}
I am trying to compare an index path in my didSelectRowAtIndexPath delegate method with an array of index paths.
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.
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
NSOrderedSame
并且没有指针 -NSComparisonResult
只是一个整数:在 Cocoa API 中,有一些非类- 使用中的类型。最重要的是来自 基础数据类型,其中包括
Use
NSOrderedSame
and no pointer -NSComparisonResult
is just an integer:In the Cocoa APIs, there are some non-class-types in use. Most important are those from the Foundation data types, which include
它只是一个包含以下值之一的 int:
在您的情况下,测试
NSOrderedSame
:It's just an int holding one of these values:
In your case, test for
NSOrderedSame
: