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
| UIButton *button = (UIButton *)sender; | |
| button.transform = CGAffineTransformMakeScale(1.2, 1.2); | |
| [UIView animateWithDuration:0.2 animations:^{ | |
| button.transform = CGAffineTransformMakeScale(1.0, 1.0); | |
| } completion:^(BOOL finished) { | |
| }]; |
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
| UIViewController *mainViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController]; | |
| while (mainViewController.presentedViewController != nil) { | |
| mainViewController = mainViewController.presentedViewController; | |
| } | |
| [mainViewController presentViewController:kidsLockViewController animated:YES completion: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
| - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath | |
| { | |
| cell.contentView.backgroundColor = [UIColor clearColor]; | |
| UIView *whiteRoundedCornerView = [[UIView alloc] initWithFrame:CGRectMake(10,10,300,70)]; | |
| whiteRoundedCornerView.backgroundColor = [UIColor whiteColor]; | |
| whiteRoundedCornerView.layer.masksToBounds = NO; | |
| whiteRoundedCornerView.layer.cornerRadius = 3.0; | |
| whiteRoundedCornerView.layer.shadowOffset = CGSizeMake(-1, 1); | |
| whiteRoundedCornerView.layer.shadowOpacity = 0.5; | |
| [cell.contentView addSubview:whiteRoundedCornerView]; |
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 *)encodeURL:(NSString *)url { | |
| NSString * encoded = (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes( | |
| NULL, | |
| (__bridge CFStringRef)url, | |
| NULL, | |
| (CFStringRef)@"!*'();:@&=+$,/?%#[]", | |
| kCFStringEncodingUTF8); | |
| return encoded; | |
| } |
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
| UIViewController willRotateToInterfaceOrientation:duration:] | |
| [UIViewController viewWillLayoutSubviews] | |
| [UIView layoutSubviews] | |
| [UIViewController viewDidLayoutSubviews] | |
| [UIViewController willAnimateRotationToInterfaceOrientation:duration:] | |
| [UIViewController shouldAutorotateToInterfaceOrientation:] | |
| [UIViewController didRotateFromInterfaceOrientation:] | |
| And when presenting a view controller we get the following: | |
| [UIViewController loadView] |
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
| NSLog(@"%@", [UIPasteboard generalPasteboard].string); | |
| [[UIPasteboard generalPasteboard] setString:@"google.com"]; | |
| NSLog(@"%@", [UIPasteboard generalPasteboard].string); | |
| [UIPasteboard generalPasteboard]; |
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 *)bubbleSort:(NSMutableArray *)unsorted comparator:(NSComparator)comparator | |
| { | |
| BOOL done = false; | |
| while (!done) { | |
| done = true; | |
| for (int i = 1; i < unsorted.count; i++) { | |
| if (comparator( [unsorted objectAtIndex:i-1], [unsorted objectAtIndex:i] ) == NSOrderedDescending ) { | |
| [unsorted exchangeObjectAtIndex:i withObjectAtIndex:i-1]; | |
| done = false; |
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
| /* | |
| RaceCondition using GCD in Objective-C | |
| localCountLabel and globalCountLabel increment 1, 5 through each Thread | |
| */ | |
| __block NSUInteger localCount1, localCount2, localCount3, globalCount; | |
| UILabel *localCountLabel1, *localCountLabel2, *localCountLabel3, *globalCountLabel; | |
| localCountLabel1 = [[UILabel alloc]init]; | |
| localCountLabel2 = [[UILabel alloc]init]; |
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 *str = @"Hello,World"; | |
| NSString *fowardStr = @""; | |
| NSString *behindStr = @""; | |
| for (NSInteger i = str.length/2-1; i >= 0; i--) { | |
| NSLog(@"Foward : %c", [str characterAtIndex:i]); | |
| fowardStr = [fowardStr stringByAppendingString:[NSString stringWithFormat:@"%c", [str characterAtIndex: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
| protocol Coffee { | |
| func getCost() -> Double | |
| func getIngredients() -> String | |
| } | |
| class SimpleCoffee: Coffee { | |
| func getCost() -> Double { | |
| return 1.0 | |
| } | |
| func getIngredients() -> String { |