2011-02-09 57 views
0

我有一個名爲Namearray的可變數組,其中包含7-8個對象。iphonesdk nsmutable數組對象問題

我想檢查它是否包含0對象,然後我會顯示警報視圖。

我該寫些什麼來檢查Namearray是否包含零對象。

回答

3
if ([NameArray count] == 0) 
{ 
    // show alertview 
} 
0

對不起,只是檢查,發現了我自己。如果任何一個尋找答案:

if(NameArray.count == 0) 
{ 
    UIAlertView *baseAlert = [[UIAlertView alloc] 
           initWithTitle:@"" 
           message:@"You have missed a place, write everything please....." 
           delegate:self cancelButtonTitle:nil 
           otherButtonTitles:@"OK", nil]; 
    [baseAlert show];  
} 
-1

如果使用array.count那麼你的問題將得到解決....

+0

`count`不是屬性,因此它不應該與使用點語法。 – 2011-02-13 16:33:45