我有以下的NSArray:過濾NSArray的NSDictionary的與通過int值
(
{
establecimiento = 15;
internet = 500;
},
{
establecimiento = 0;
internet = 1024;
},
{
establecimiento = 24;
internet = 300;
}
)
,我需要的陣列篩選establecimiento < 10
。
我想這一點:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"establecimiento = %@", [NSNumber numberWithInt:self.establecimientoFiltro]];
其中self.establecimientoFiltro
是價值的int:10
但我作爲導致一個空數組。
希望能夠清楚地回答我的問題,並提前感謝您的答案。
問候, 維克多
如果你想<10,你爲什麼要用「=」? – rdelmar
@ user3175572查看下面的答案以獲得靈活的輸出結果。 – Pavan
而且沒有必要將您的號碼轉換爲NSNumber - 您可以直接用'%d'使用號碼。 –