获取NSMutableArray中的对象索引 [英] Get the index of object in NSMutableArray

查看:69
本文介绍了获取NSMutableArray中的对象索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道NSMutableArray(或NSArray)中是否有任何方法可以获取特定对象的索引?例如,如果有一个具有
abcdefghi对象的数组,我如何获得类似c或e或任何其他对象的索引?

Just wanted to know if there is any method in NSMutableArray (or NSArray) which lets you get the index of a specific object? for example if have an array which has a b c d e f g h i objects how can I get the index for like c or e or any other object?

推荐答案

NSArray 有一些方法 indexOfObject:将为您提供对象的索引。这一切都取决于你想要完成的事情。阅读提供的链接中的文档,您应该找到您要找的内容。

NSArray has methods along the lines of indexOfObject: that will give you the index of an object. It all depends on what you're trying to accomplish. Read through the documentation at the links provided and you should find what you're looking for.

这篇关于获取NSMutableArray中的对象索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆