NSarray不用遍历jquery对象数组能否判断一个对象是否存在在数组里面

NSarray不用遍历能否判断一个对象是否存在在数组里面_百度知道
NSarray不用遍历能否判断一个对象是否存在在数组里面
提问者采纳
checkBox被选中 {  this-&****槽函数; } else {  this-&displayCheckBox():&#47.cpp文件中添加槽函数on_checkBox_clicked();displayCheckBox()::on_checkBox_clicked(){ if(ui-&&#47:选中CheckBox1****/isChecked())     /checkBox-&void MainWindow在主窗体mainwindow
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁主题 : NSarray不用遍历能否判断一个对象是否存在在数组里面?
级别: 骑士
UID: 268916
可可豆: 1089 CB
威望: 1076 点
在线时间: 345(时)
发自: Web Page
NSarray不用遍历能否判断一个对象是否存在在数组里面?&&&
如题NSarray不用遍历能否判断一个对象是否存在在数组里面?[ 此帖被在 15:06重新编辑 ]
级别: 骑士
UID: 268916
可可豆: 1089 CB
威望: 1076 点
在线时间: 345(时)
发自: Web Page
噢,好像是这个[self.dataSource indexOfObject:taskTypeEntity];吧
级别: 侠客
UID: 153346
可可豆: 350 CB
威望: 322 点
在线时间: 914(时)
发自: Web Page
回 1楼() 的帖子
[dataArray indexOfObject:object] != NSNotFound。对的0 0
关注本帖(如果有新回复会站内信通知您)
3*3+1 正确答案:10
发帖、回帖都会得到可观的积分奖励。
按"Ctrl+Enter"直接提交
关注CocoaChina
关注微信 每日推荐
扫一扫 浏览移动版11024人阅读
前言:NSArray对应的是java的List,不同的是其元素不能更改,不过其派生类NSMutableArray可以更改,遍历的方式跟java的List基本一样
一. &for循环
Student *stu = [Student student];
NSArray *array = [NSArray arrayWithObjects:stu, @&1&,@&2&,nil];
int count = array.//减少调用次数
for( int i=0; i& i++){
NSLog(@&%i-%@&, i, [array objectAtIndex:i]);
}二. &增强for
for(id obj in array){
NSLog(@&%@&,obj);
}三. &迭代器
NSEnumerator *enumerator = [array objectEnumerator];
while(obj = [enumerator nextObject]){
NSLog(@&obj=%@&,obj);
四. &Block块遍历
[array enumeratorObjectsUsingBlock:
^(id obj, NSUInteger index, BOOL
NSLog(@&%i-%@&,index,obj);
//若终断循环
*stop = YES;
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:112623次
积分:1188
积分:1188
排名:千里之外
原创:25篇
评论:30条
(2)(2)(1)(1)(1)(4)(4)(1)(1)(1)(1)(3)(5)NSDictionary深度遍历,包含数组怎么办?
[问题点数:80分,结帖人liyun123gx]
NSDictionary深度遍历,包含数组怎么办?
[问题点数:80分,结帖人liyun123gx]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
2015年4月 移动开发大版内专家分月排行榜第二
2015年5月 移动开发大版内专家分月排行榜第三2015年3月 移动开发大版内专家分月排行榜第三2014年10月 移动开发大版内专家分月排行榜第三
2015年4月 移动开发大版内专家分月排行榜第二
2015年5月 移动开发大版内专家分月排行榜第三2015年3月 移动开发大版内专家分月排行榜第三2014年10月 移动开发大版内专家分月排行榜第三
2015年5月 移动开发大版内专家分月排行榜第一2015年4月 移动开发大版内专家分月排行榜第一2014年9月 移动开发大版内专家分月排行榜第一
2015年3月 移动开发大版内专家分月排行榜第二2014年8月 移动开发大版内专家分月排行榜第二
2015年4月 移动开发大版内专家分月排行榜第二
2015年5月 移动开发大版内专家分月排行榜第三2015年3月 移动开发大版内专家分月排行榜第三2014年10月 移动开发大版内专家分月排行榜第三
匿名用户不能发表回复!|
每天回帖即可获得10分可用分!小技巧:
你还可以输入10000个字符
(Ctrl+Enter)
请遵守CSDN,不得违反国家法律法规。
转载文章请注明出自“CSDN(www.csdn.net)”。如是商业用途请联系原作者。当前访客身份:游客 [
充实的生活才能找到自信。欢迎访问个人博客网站:lupeng.me
:谢谢分享,学习了!
:总结的很好,已收藏,赞已奉上!
:[国外超稳定和便宜的VPS:vultr vs digitalocean...
:透彻,易懂,很棒的文章!
:引用来自“zhongxh”的评论 发现你是被windows的...
:发现你是被windows的方便惯坏了,人啊就是贱。我...
今日访问:4
昨日访问:75
本周访问:171
本月访问:561
所有访问:29363
objective-c数组的四种遍历方法总结
发表于2年前( 11:15)&&
阅读(9411)&|&评论()
0人收藏此文章,
objective-c 语言 数组遍历的4种方式:1、普通for循环;2、快速for循环;3、特性block方法;4、枚举方法。
#import "Blog.h"
@implementation Blog
+(Blog *)blog{
Blog * blog = [[Blog alloc] init];
-(Blog *)setBlogTitle:(NSString *)title andContent:(NSString *)content{
_content =
-(NSString *)description{
return [NSString stringWithFormat:@"blog : title is \"%@\" , and content is \"%@\"", _title,_content ];
-(void)dealloc{
NSLog(@"%@被销毁了",self.title);
#pragma mark Array数组的四种遍历方法
void testArray(){
Blog *blog1 = [[Blog blog] setBlogTitle:@"Love" andContent:@"I love you"];
Blog *blog2 = [[Blog blog] setBlogTitle:@"Friendship" andContent:@"you are my best friend"];
NSArray *array = [NSArray arrayWithObjects:@"hello",@"world",blog1,blog2, nil];
//第一种遍历:普通for循环
long int count = [array count];
for (int i = 0 ; i & i++) {
NSLog(@"1遍历array: %zi--&%@",i,[array objectAtIndex:i]);
//第二种遍历:快速for循环,需要有外变量i
int i = 0;
for (id obj in array) {
NSLog(@"2遍历array:%zi--&%@",i,[array objectAtIndex:i]);
//第三种遍历:OC自带方法enumerateObjectsUsingBlock:
//默认为正序遍历
[array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSLog(@"3遍历array:%zi--&%@",idx,obj);
//NSEnumerationReverse参数为倒序遍历
[array enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSLog(@"4倒序遍历array:%zi--&%@",idx,obj);
//第四种遍历:利用枚举
NSEnumerator *en = [array objectEnumerator];
int j = 0 ;
while (obj = [en nextObject]) {
NSLog(@"5遍历array:%d--&%@",j,obj);
int main(int argc, const char * argv[])
@autoreleasepool {
testArray();
更多开发者职位上
1)">1)">1" ng-class="{current:{{currentPage==page}}}" ng-repeat="page in pages"><li class='page' ng-if="(endIndex<li class='page next' ng-if="(currentPage
相关文章阅读}

我要回帖

更多关于 js 遍历数组对象 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信