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
//objective-c | |
-//random bool | |
srand(time(0)); | |
int randomval = rand() % 2; | |
apiCall.shouldFailToLoad = (BOOL)randomval; | |
NSLog(@"Should fail to load:%d", apiCall.shouldFailToLoad); | |
-//random integer | |
arc4random_uniform(upper_bound) |
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
__weak __typeof(self) weakSelf = self; | |
__strong __typeof(weakSelf) strongSelf = weakSelf; |
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)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id <UIViewControllerTransitionCoordinator>)coordinator | |
{ | |
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; | |
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { | |
// Stuff you used to do in willRotateToInterfaceOrientation would go here. | |
// If you don't need anything special, you can set this block to nil. | |
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
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
//Obhective-C | |
for (NSString* family in [UIFont familyNames]) | |
{ | |
NSLog(@"%@", family); | |
for (NSString* name in [UIFont fontNamesForFamilyName: family]) | |
{ | |
NSLog(@" %@", name); | |
} | |
} |
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)configureGradientView:(UIView *)aView { | |
CAGradientLayer *gradient = [CAGradientLayer layer]; | |
gradient.frame = aView.bounds; | |
gradient.colors = @[(id)[UIColor colorWithWhite:0.f alpha:0.01f].CGColor, | |
(id)[UIColor colorWithWhite:0.f alpha:0.02f].CGColor, | |
(id)[UIColor colorWithWhite:0.f alpha:0.03f].CGColor, | |
(id)[UIColor colorWithWhite:0.f alpha:0.2f].CGColor, | |
(id)[UIColor colorWithWhite:0.f alpha:0.3f].CGColor, |
NewerOlder