This file contains 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
// See http://mindsea.com/2012/12/18/downscaling-huge-alassets-without-fear-of-sigkill for details | |
#import <AssetsLibrary/AssetsLibrary.h> | |
#import <ImageIO/ImageIO.h> | |
// Helper methods for thumbnailForAsset:maxPixelSize: | |
static size_t getAssetBytesCallback(void *info, void *buffer, off_t position, size_t count) { | |
ALAssetRepresentation *rep = (__bridge id)info; | |
NSError *error = nil; |
This file contains 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 *numberString = @"0"; | |
NSNumber *number = [NSNumber numberWithInt:_selectedCounter]; | |
numberString = [numberString stringByAppendingString:number.description]; | |
cell.numberLabel.text = numberString; | |
cell.numberLabel.hidden = NO; |
This file contains 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
// move item to clip marker | |
// save current touch.x as N | |
// if continue: | |
// calculate displacement from N point | |
// if displacement > threshold | |
// move item.center to current touch point; | |
// reset N; |
This file contains 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
pbcopy < ~/.ssh/id_rsa.pub |
This file contains 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
AVMutableComposition* mixComposition = [[AVMutableComposition alloc] init]; | |
NSString *path1 = _exportPaths[0]; | |
NSString *path2 = _exportPaths[1]; | |
//load assets | |
AVURLAsset *asset1 = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:path1] options:nil]; | |
AVURLAsset *asset2 = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:path2] options:nil]; | |
//create mutable composition track and add all assets to this track | |
AVMutableCompositionTrack *track = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; |
This file contains 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)viewDidLayoutSubviews { | |
[super viewDidLayoutSubviews]; | |
_scrollView.contentOffset = _lastOffset; | |
} | |
-(void)viewDidDisappear:(BOOL)animated | |
{ | |
[self unregisterForKeyboardNotifications]; | |
_lastOffset = _scrollView.contentOffset; | |
_scrollView.contentOffset = CGPointZero; |
This file contains 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
-(CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if (indexPath.section == SectionNumberInfo) | |
{ | |
NSString *str = _group.groupDescription; | |
CGSize labelSize = [str sizeWithFont:[UIFont fontWithName:@"Helvetica" size:17] constrainedToSize:CGSizeMake(260, 400) lineBreakMode:NSLineBreakByTruncatingTail]; | |
// 112 (logo height) + 13(logo to margin) + 8(logo bottom margin) + 40(label bottom margin) = 173 | |
CGFloat result = 173 + labelSize.height; |
This file contains 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 *)cacheFilenameForURL:(NSURL *)resourceURL atSize:(CGSize)size atScaleFactor:(CGFloat)scaleFactor atPage:(int)page | |
{ | |
NSString *cacheFilename = nil; | |
#ifdef UIIMAGE_PDF_CACHEING | |
NSFileManager *fileManager = [ NSFileManager defaultManager ]; | |
NSString *filePath = [ resourceURL path ]; | |
This file contains 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
//for loggin memory usage: | |
#import "mach/mach.h" | |
vm_size_t usedMemory(void) { | |
struct task_basic_info info; | |
mach_msg_type_number_t size = sizeof(info); | |
kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size); | |
return (kerr == KERN_SUCCESS) ? info.resident_size : 0; // size in bytes | |
} |
This file contains 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
#ifdef DEBUG | |
#define NSLog(...) NSLog(__VA_ARGS__) | |
#else | |
#define NSLog(...) | |
#endif |
OlderNewer