Skip to content

Instantly share code, notes, and snippets.

View markSci5's full-sized avatar

Mark Dhem S. Mansueto markSci5

View GitHub Profile
@markSci5
markSci5 / MySingleton.h
Created July 2, 2013 02:50
iOS Singleton
#import <Foundation/Foundation.h>
@interface MySingleton : NSObject
- (id)sharedInstance;
@end
@markSci5
markSci5 / Git Merge Config With Merge Base
Created July 3, 2013 03:32
Git config for merging to see the merge base code
git config --global merge.conflictstyle diff3
@markSci5
markSci5 / Git stage deleted files
Created July 3, 2013 04:57
Stage all removed files
git add -u
@markSci5
markSci5 / Balsamiq Useful shortcuts
Created July 4, 2013 05:26
Balsamiq useful shortcuts
/ - Quick Add
Hold Shift while resizing - Maintain aspect ration
Hold Command while moving object - Removes snapping
Shift + Direction while an object is selected - Moves object faster
Command + Alt + (Shift) + Direction while an object is selected - Resizes object
Command + Up/Down - Moves selected layer up or down 1 level
Command + (Shift) + Up/Down - Moves selected layer to top or bottom layer
Alt + Drag object - Duplicate object
Shift + click another object - Add object to current selection
Command + click another object - Add object to current selection
@markSci5
markSci5 / UIStoryboard controller instantiation
Created July 9, 2013 03:19
UIStoryboard controller instantiation
// Get the storyboard named secondStoryBoard from the main bundle:
UIStoryboard *secondStoryBoard = [UIStoryboard storyboardWithName:@"secondStoryBoard" bundle:nil];
// Load the initial view controller from the storyboard. // Set this by selecting 'Is Initial View Controller' on the appropriate view controller in the storyboard.
UIViewController *theInitialViewController = [secondStoryBoard instantiateInitialViewController];
// Then push the new view controller in the usual way:
[self.navigationController pushViewController:theTabBar animated:YES];
@markSci5
markSci5 / Storyboard accessing category
Created July 9, 2013 03:21
Storyboard category for accessing different storyboards
@implementation UIStoryboard (MyApp)
+ (UIStoryboard *)mainStoryboard {
return [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
}
@end
@markSci5
markSci5 / UINavigationController+Autorotation.h
Created July 9, 2013 07:52
Allow navigation controller's view controllers to follow their own orientation rules
@interface UINavigationController (autorotation)
-(BOOL)shouldAutorotate;
-(NSUInteger)supportedInterfaceOrientations;
@end
@markSci5
markSci5 / iOS Version Detection
Created July 16, 2013 08:00
iOS 7 and 6 detection
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
} else {
// Load resources for iOS 7 or later
}
@markSci5
markSci5 / git-push-all
Created August 13, 2013 02:09
Push all remote branches and their tags
git push --all
git push --tags
@markSci5
markSci5 / Instructions
Created August 13, 2013 02:56
Convert iPhone storyboard to iPad.
1. Duplicate your iPhone-Storyboard and rename it MainStoryboard_iPad.storyboard
2. Open this file any text editor.
3. Search for targetRuntime="iOS.CocoaTouch"and change it to targetRuntime="iOS.CocoaTouch.iPad"
4. Now save everything and reopen Xcode -> the iPad-Storyboard contains the same as the iPhone-file but everyting could be disarranged