草庐IT

wallpaperPriceArray

全部标签

ios NSPredicate 在 NSDictionary 中查找最近的值

我有一个像这样的字典数组:({key=1,value=40},{key=4,value=50},{key=8,value=60}}这些是这样的,for>=1项目成本是40,for>=4itemcostis50同样明智。我想获得5的值,在本例中为50。我试过的一段代码是:NSMutableArray*wallpaperPriceArray=[[NSMutableArrayalloc]init];//AssumingthishasallthedictionaryvaluesfloatwallpaperPriceValue=0;intitemNumber=0;for(inti=0;i=[[w