How to write Objective-C Blocks inline?
问题 I am trying to implement a binary search using objective-c blocks. I am using the function indexOfObject:inSortedRange:options:usingComparator: . Here is an example. // A pile of data. NSUInteger amount = 900000; // A number to search for. NSNumber* number = [NSNumber numberWithInt:724242]; // Create some array. NSMutableArray* array = [NSMutableArray arrayWithCapacity:amount]; for (NSUInteger i = 0; i < amount; ++i) {; [array addObject:[NSNumber numberWithUnsignedInteger:i]]; }