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
let shadow = NSShadow() | |
shadow.shadowColor = UIColor = UIColor.black.withAlphaComponent(0.3) | |
shadow.shadowOffset = CGSize(width: 2.0, height: 2.0) | |
shadow.shadowBlurRadius = 5.0 | |
let attributes = [NSAttributedStringKey.shadow: shadow] | |
label.attributedText = NSAttributedString(string: "Text with shadow", attributes: attributes) |
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
view.layer.shadowOffset = CGSize(width: 5.0, height: 5.0) | |
view.layer.shadowColor = UIColor.black.cgColor | |
view.layer.shadowRadius = 5.0 | |
view.layer.shadowOpacity = 0.5 | |
view.layer.shadowPath = UIBezierPath(rect: view.bounds).cgPath |
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
int *array = (int *)calloc(1, sizeof(int) * 2); | |
printf("The initial arrays location is %p\n", array); | |
array[1] = 777; | |
int size = sizeof(array)/sizeof(array[0]); | |
for(int i = 0; i < size; i++) { | |
printf("%d ", array[i]); // show the array | |
} | |
printf("\n"); |
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
layer.shadowPath = CGPathCreateWithRect(layer.bounds, 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
CALayer *layer = [[CALayer alloc] init]; | |
layer.shadowColor = [UIColor purpleColor].CGColor; | |
layer.shadowOpacity = 0.5; | |
layer.shadowRadius = 5.0; | |
layer.shadowOffset = CGSizeMake(1.0, 1.0); |
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
NSString *filename = [[NSBundle mainBundle] pathForResource:@“fileName.png” ofType:nil]; | |
if (filename) { | |
[UIImage imageWithContentsOfFile:filename]; | |
} |
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
- (instancetype)initWithURLs:(NSDictionary *)urls | |
{ | |
_imageUrls = urls; // something like @{@"thumb": "/smallImageUrl", @"/medium": ...} | |
_multiplexImageNode = [[ASMultiplexImageNode alloc] initWithCache:nil downloader:[[ASBasicImageDownloader alloc] init]]; | |
_multiplexImageNode.downloadsIntermediateImages = YES; | |
_multiplexImageNode.imageIdentifiers = @[ @"original", @"medium", @"thumb" ]; | |
… | |
} |
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
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
_imageNode = [[ASNetworkImageNode alloc] init]; | |
_imageNode.defaultImage = [UIImage imageNamed:@"lightGrayPlaceholder"]; | |
_imageNode.frame = CGRectMake(0, 0, _screenWidth - 2, _screenHeight * (5.0/12.0)); | |
_imageNode.cornerRadius = 2; | |
_imageNode.delegate = self; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[self.view addSubview:_imageNode.view]; | |
}); |
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
:convert_options => { | |
:medium => "-quality 80 -interlace Plane", | |
:thumb => "-quality 80 -interlace Plane" | |
} |
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
:convert_options => { thumb: "-interlace Plane" } |