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
let offSetHieght = UIApplication.shared.statusBarFrame.height + self.navigationController!.navigationBar.frame.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
#include the branch you want to build | |
general: | |
branches: | |
only: | |
- master | |
- develop | |
machine: | |
xcode: | |
version: 8.1 |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
//call this after download or after saving a file | |
//Example: [self addSkipBackupAttributeToItemAtURL:[NSURL fileUrlWithPath:@"your path here"]]; | |
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL | |
{ | |
assert([[NSFileManager defaultManager] fileExistsAtPath: [URL path]]); | |
NSError *error = nil; | |
BOOL success = [URL setResourceValue: [NSNumber numberWithBool: YES] | |
forKey: NSURLIsExcludedFromBackupKey error: &error]; |
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
//viewDidload | |
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { | |
// iOS 7 | |
[self prefersStatusBarHidden]; | |
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; | |
} else { | |
// iOS 6 | |
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; | |
} |
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
//in AppDelegate.m | |
// Add this inside NSPersistenStoreCoordinator delegate | |
/* Note: NSPersistenStoreCoordinator delegate is automatically created if you create | |
empty application and selected "use Core Data" | |
*/ | |
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys: | |
[NSNumber numberWithBool: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
//all stuffs will be on the Appdelegate.m | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
//some appdelegate codes here...... | |
[self checkDatabaseIfExists]; //Makes sure that the app has a database | |
//some appdelegate codes here ...... | |
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
/* | |
To call: | |
[self showErrorWithTitle:@"Error" withMessage:@"Your Device Sucks!"]; | |
*/ | |
- (void)showErrorWithTitle:(NSString *)title withMessage:(NSString *)message{ | |
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:title message:message delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, 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
/* | |
To call: | |
myArray = [self fetchDataWithEntityName:@"Employees" withSortDescriptorKey:@"name" withPredicateFormat:[NSPredicate predicateWithFormat:@"employee == %@", myEmployeeName]; | |
*/ | |
- (NSArray *)fetchDataWithEntityName:(NSString *)entityName withSortDescriptorKey:(NSString *) sortDescriptorKey withPredicateFormat:(NSPredicate *)predicateFormat{ | |
NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:context]; | |
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
// Implement pickerview delegate | |
// Add some stuffs inside | |
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{ | |
UILabel *pickerLabel = (UILabel *)view; | |
CGRect frame = CGRectMake(0,0,250,40); | |
pickerLabel = [[UILabel alloc] initWithFrame:frame]; | |
[pickerLabel setTextAlignment:UITextAlignmentCenter]; |
NewerOlder