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
id obj; | |
// Creating a variable at run time | |
objc_setAssociatedObject(obj,@"variable", variable, OBJC_ASSOCIATION_RETAIN); | |
// Accessing the variable later | |
objc_getAssociatedObject(obj,@"variable"); |
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
#define LocalizedString(s) NSLocalizedStringFromTableInBundle((s),@"Localizable", [AppDelegate GetLocalizebundle], 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
git checkout --track origin/new_branch |
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 *)timeFormatted:(int)totalSeconds | |
{ | |
int seconds = totalSeconds % 60; | |
int minutes = (totalSeconds / 60) % 60; | |
int hours = totalSeconds / 3600; | |
return [NSString stringWithFormat:@"%02d:%02d:%02d",hours, minutes, seconds]; | |
} |
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
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil]; | |
CustomVC *vc = [storyboard instantiateViewControllerWithIdentifier:STORYBOARDID_VC_ID]; | |
[self.navigationController pushViewController:vc animated:YES]; |
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
git stash save --keep-index | |
git stash drop | |
git push origin newBranch // pushing local branch to remote |
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
CGPoint p = [gestureRecognizer locationInView:self.tableView]; | |
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:p]; | |
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) | |
{ | |
if (indexPath == nil) | |
{ | |
NSLog(@"long press on table view but not on a row"); | |
} | |
else |
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
// resign keyboard | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_current_queue(), ^{ | |
[SVProgressHUD showWithStatus:@"Searching..." maskType:SVProgressHUDMaskTypeBlack]; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
//do search | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
//search finished - do smth with search results and hide hud | |
[SVProgressHUD dismiss]; |
NewerOlder