Skip to content

Instantly share code, notes, and snippets.

let offSetHieght = UIApplication.shared.statusBarFrame.height + self.navigationController!.navigationBar.frame.height
@Marlunes
Marlunes / circle.yml
Last active January 13, 2017 10:07
iOS 9.0, xcode 8.1 --> Circle CI Crashlytics Deployment
#include the branch you want to build
general:
branches:
only:
- master
- develop
machine:
xcode:
version: 8.1
@Marlunes
Marlunes / 0_reuse_code.js
Created October 4, 2013 08:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Marlunes
Marlunes / ignoreIcloud
Created August 30, 2013 05:38
Ignore iCloud Backup
//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];
@Marlunes
Marlunes / hide_status_bar
Created July 16, 2013 07:54
FORCE HIDE STATUS BAR FOR IOS 7 AND 6
//viewDidload
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
@Marlunes
Marlunes / Core_data_migration
Created July 9, 2013 09:03
CORE DATA MIGRATION
//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],
@Marlunes
Marlunes / sqlite_addDB
Created July 4, 2013 07:01
ADDING SQLite DATABASE
//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 ......
@Marlunes
Marlunes / alert_message
Created July 4, 2013 06:53
ALERT MESSAGE
/*
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];
@Marlunes
Marlunes / fetch_request
Created July 4, 2013 06:36
FETCH REQUEST
/*
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];
@Marlunes
Marlunes / customize_picker
Created July 4, 2013 06:30
CUSTOMIZE PICKERVIEW TEXT/CONTENT
// 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];