comparing arrays in objective-c

前端 未结 5 2004
梦谈多话
梦谈多话 2020-12-09 11:24

Ok a pretty simple question.. in c++ it seems to work but in objective-c i seem to struggle with it :S .. If you want to compare two arrays it should be something like thi

5条回答
  •  悲&欢浪女
    2020-12-09 11:56

    Try telling us the result you're getting when you run this code. The approach is correct, but try this one:

    for (int i =0; i< appdelegate.nicearray.count; i++)
    {
        if ([[appdelegate objectAtIndex:i] isEqual: [appdelegate.exercarray objectAtIndex:i]])
        {
            NSLog(@"the same");
        }
    }  
    

提交回复
热议问题