This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This is an example provided by Facebook are for non-commercial testing and | |
* evaluation purposes only. | |
* | |
* Facebook reserves all rights not expressly granted. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | |
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
@weakify(self); | |
self.exploreSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, mTCTableViewFrameWidth, 44)]; | |
self.exploreSearchBar.placeholder = @"Search"; | |
[self.exploreSearchBar setBackgroundImage:[UIImage squareImageWithColor:mTCLightTanColor dimension:1] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; | |
self.tableView.tableHeaderView = self.exploreSearchBar; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void (^myBlock)(int); | |
__block __weak __typeof__(myBlock) myRecursiveBlock = myBlock = ^(int x) { | |
if (x > 5) { | |
return; | |
} else { | |
myRecursiveBlock(x + 1); | |
} | |
}; | |
myBlock(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSArray *)mapConcurrent; | |
{ | |
NSArray *originals = self.listOfObjects; | |
NSUInteger count = originals.count; | |
NSMutableArray *collected = [[NSMutableArray alloc] initWithCapacity:count]; | |
for (NSUInteger i = 0; i < count; i++) { | |
[collected addObject:[NSNull null]]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGRect CGRectIntegralScaledEx(CGRect rect, CGFloat scale) | |
{ | |
return CGRectMake(floorf(rect.origin.x * scale) / scale, floorf(rect.origin.y * scale) / scale, ceilf(rect.size.width * scale) / scale, ceilf(rect.size.height * scale) / scale); | |
} | |
CGRect CGRectIntegralScaled(CGRect rect) | |
{ | |
return CGRectIntegralScaledEx(rect, [[UIScreen mainScreen] scale]); | |
} |