菜鸟教程小白 发表于 2022-12-12 20:48:12

objective-c - 在 NSDictionary 中存储 indexPath


                                            <p><p>我想存储一个 <code>NSIndexPath</code> 一个 <code>NSDictionaries</code> 数组供以后比较。</p>

<p>我知道我可以通过将 2 个数字存储为 2 个键来做到这一点</p>

<pre><code>NSNumber *selRow = [ initWithInteger:indexPath.row];
NSNumber *selSection = [ initWithInteger:indexPath.section];
</code></pre>

<p>但是那样我不能一次过滤数组。</p>

<p>有没有办法直接存储(并取回)<code>NSIndexPath</code>?</p>

<p>提前致谢。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>为什么不直接存储呢? <code>NSIndexPath</code> 是一个对象,所以没关系。您可以在 <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/Reference/Reference.html" rel="noreferrer noopener nofollow">documentation</a> 上查看继承自 <code>NSObject</code>。</p></p>
                                   
                                                <p style="font-size: 20px;">关于objective-c - 在 NSDictionary 中存储 indexPath,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/10546947/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/10546947/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: objective-c - 在 NSDictionary 中存储 indexPath