我是新來的iPhone JIANGSU作者:孫軍,比較兩個NSMutableArray的指數在iPhone
我想比較兩個數組下標,
for (int i=0; i<[CustomeDateArray count]; i++)
{
if (([CustomeDateArray objectAtIndex:1] == [newDateArray objectAtIndex:1]) && ([CustomeDateArray objectAtIndex:2] == [newDateArray objectAtIndex:2]))
{
exists=TRUE;
NSLog(@"exists=TRUE");
}
}
我的日誌顯示了這種結果:
CustomeDateArray at Index1=06
CustomeDateArray at Index2=2012
newDateArray at Index1=06
newDateArray at Index2=2012
如果我的if
條件成立,那麼控件應該放在裏面,它應該打印exists=TRUE
但我無法看到exists=TRUE
控制不進去。
有什麼問題?
任何幫助將不勝感激。
所以,'TRUE'與Objective-C中的YES相同,'FALSE'與'NO'相同,但您應該習慣使用'YES'和'NO'。所有Apple的示例代碼都使用它們,我在互聯網上見過的大部分代碼也是如此。 – 2012-07-17 06:55:38