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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<!-- default ordered fallback list - fallback entity has to be PostScript name --> | |
<key>default</key> | |
<array> | |
<string>LucidaGrande</string> <!-- MAKE sure this matches the kCTFontSystemFontType in CTFontDescriptorCreateForUIType() & TDescriptorSourceImp::CreateDefaultDescriptor()! --> | |
<string>AppleSymbolsFB</string> | |
<string>GeezaPro</string> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<!-- default ordered fallback list - fallback entity has to be PostScript name --> | |
<key>default</key> | |
<array> | |
<string>LucidaGrande</string> <!-- MAKE sure this matches the kCTFontSystemFontType in CTFontDescriptorCreateForUIType() & TDescriptorSourceImp::CreateDefaultDescriptor()! --> | |
<string>AppleSymbolsFB</string> | |
<string>GeezaPro</string> |
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 *albums = @[[Album albumWithName:@"Random Access Memories" price:9.99f], | |
[Album albumWithName:@"Clarity" price:6.99f], | |
[Album albumWithName:@"Weekend in America" price:7.99f], | |
[Album albumWithName:@"Weekend in America" price:7.90f], | |
[Album albumWithName:@"Bangarang EP" price:2.99f]]; | |
// Reversing an Array | |
__unused NSArray *reversed = albums.reverseObjectEnumerator.allObjects; | |
// PREDICATES |
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
NSURL *imageUrl; | |
CGImageSourceRef imageScorce = CGImageSourceCreateWithURL((__bridge CFURLRef)imageUrl, nil); | |
NSDictionary *options = @{(__bridge NSString *)kCGImageSourceCreateThumbnailFromImageIfAbsent:(id)kCFBooleanTrue, | |
(__bridge NSString *)kCGImageSourceCreateThumbnailWithTransform:(id)kCFBooleanTrue, | |
(__bridge NSString *)kCGImageSourceThumbnailMaxPixelSize:@128}; | |
CFRelease(imageScorce); | |
CGImageRef thumbImageRef = CGImageSourceCreateThumbnailAtIndex(imageScorce, 0, (__bridge CFDictionaryRef)options); | |
NSURL *targetUrl; | |
CGImageDestinationRef destinationRef = CGImageDestinationCreateWithURL((__bridge CFURLRef)targetUrl, kUTTypeJPEG, 1, nil); |
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
#import <objc/runtime.h> | |
#define AtomicRetainedSetToFrom(dest, source) \ | |
objc_setProperty(self, _cmd, (ptrdiff_t)(&dest) - (ptrdiff_t)(self), source, YES, false) | |
#define AtomicCopiedSetToFrom(dest, source) \ | |
objc_setProperty(self, _cmd, (ptrdiff_t)(&dest) - (ptrdiff_t)(self), source, true, true) | |
#define AtomicAutoreleaseGet(source) \ | |
objc_getProperty(self, _cmd, (ptrdiff_t)(&source) - (ptrdiff_t)(self), true) |
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
lipo -create "1.a" "2.a" -output “new.a"合并多个静态库为一个 | |
$ lipo -info libProprietary.a查看某个静态库的架构 -detailed_info更详细的信息 | |
$ lipo -thin armv6 libProprietary.a -output libProprietary-armv6.a | |
将一个多架构的.a拆分成单个架构 | |
$ ar -t libProprietary-armv6.a 查看静态库的对象文件 | |
ar -x libProprietary-armv6.a 将一个静态库解压缩成多个.o文件 |
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
- (UIImage *)captureScrollView:(UIScrollView *)scrollView{ | |
UIImage* image = nil; | |
UIGraphicsBeginImageContext(scrollView.contentSize); | |
{ | |
CGPoint savedContentOffset = scrollView.contentOffset; | |
CGRect savedFrame = scrollView.frame; | |
scrollView.contentOffset = CGPointZero; | |
scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height); | |
[scrollView.layer renderInContext: UIGraphicsGetCurrentContext()]; |
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)load { | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
Class class = [self class]; | |
SEL viewDidLoadOriginalSelector = @selector(viewDidLoad); | |
SEL viewDidLoadswizzledSelector = @selector(set_webViewControllerViewDidLoad); | |
Method viewDidLoadOriginalMethod = class_getInstanceMethod(class, viewDidLoadOriginalSelector); | |
Method viewDidLoadSwizzledMethod = class_getInstanceMethod(class, viewDidLoadswizzledSelector); | |
BOOL didAddMethod = class_addMethod(class, viewDidLoadOriginalSelector, | |
method_getImplementation(viewDidLoadSwizzledMethod), |
OlderNewer