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)switchToViewController:(UIViewController *)viewController | |
{ | |
UIViewController *currentViewController = self.childViewControllers[0]; | |
[self addChildViewController:viewController]; | |
[self transitionFromViewController:currentViewController toViewController:viewController duration:0.2 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{} | |
completion:^(BOOL finished) { | |
[currentViewController removeFromParentViewController]; | |
[self.containerView addSubview:viewController.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
class ViewController: UITableViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. |
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
NSDecimalNumber *price = [NSDecimalNumber decimalNumberWithString:@"1.99"]; | |
NSLocale *priceLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"be_BE"] autorelease]; // get the locale from your SKProduct | |
NSNumberFormatter *currencyFormatter = [[[NSNumberFormatter alloc] init] autorelease]; | |
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; | |
[currencyFormatter setLocale:priceLocale]; | |
NSString *currencyString = [currencyFormatter currencySymbol]; | |
NSString *format = [currencyFormatter positiveFormat]; | |
format = [format stringByReplacingOccurrencesOfString:@"¤" withString:currencyString]; | |
// ¤ is a placeholder for the currency symbol |
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
2 options: | |
1. set the environment variable NSObjCMessageLoggingEnabled to YES. This will write a log of all message sends in the folder /tmp/msgSends-xxx. | |
2. #import <objc/runtime.h> | |
call (void)instrumentObjcMessageSends(YES); to enable | |
call (void)instrumentObjcMessageSends(NO); to disable. All output is logged to /tmp/msgSends... |
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
// Fill this out with whatever you want. Use the same string | |
// and algorithm to scramble the files on the server. | |
static unsigned char secretString[SECRET_STRING_LENGTH]; | |
- (NSData *)scrambleOrDescrambleData:(NSData*)input | |
{ | |
unsigned char *outputBytes = malloc(input.length); | |
memcpy(outputBytes, input.bytes, input.length); | |
for (int i = 0; i < input.length; i++) | |
{ |
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 <Cocoa/Cocoa.h> | |
@interface LBHView : NSView | |
/// This property controls whether the view can indirectly control its | |
/// backing layer's properties, specifically the following: | |
/// `affineTransform` | |
/// `anchorPoint` | |
/// | |
/// These properties cannot be modified on the layer during the time that |
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 function is where all the magic happens | |
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ | |
//1. Setup the CATransform3D structure | |
CATransform3D rotation; | |
rotation = CATransform3DMakeRotation( (90.0*M_PI)/180, 0.0, 0.7, 0.4); | |
rotation.m34 = 1.0/ -600; | |
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
.DS_Store | |
*.mode1 | |
*.mode1v3 | |
*.mode2v3 | |
*.perspective | |
*.perspectivev3 | |
*.pbxuser | |
xcuserdata/ | |
project.xcworkspace/ | |
.svn |
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
NSCalendar *cal = [NSCalendar currentCalendar]; | |
NSDateComponents *comp = [NSDateComponents new]; | |
comp.day = 31; | |
comp.month = 1; | |
comp.year = 2012; | |
NSDateComponents *addMonthComp = [NSDateComponents new]; | |
addMonthComp.month = 1; | |
NSLog(@"31th Jan + 1 month: %@",[cal dateByAddingComponents:addMonthComp toDate:[cal dateFromComponents:comp] options:0]); |
NewerOlder