Skip to content

Instantly share code, notes, and snippets.

View mjjimenez's full-sized avatar

Mark Jimenez mjjimenez

View GitHub Profile
@NSExceptional
NSExceptional / UpdateXcodePluginUUIDs.m
Last active December 23, 2015 10:25
A program that adds the UUID of the current installation of Xcode (in /Applications/Xcode.app) to every Xcode plug-in's Info.plist. Does nothing if the plug-in already contains the current UUID.
//
// main.m
// UpdateXcodePluginUUIDs
//
// Created by Tanner on 12/21/15.
// Copyright © 2015 Tanner Bennett. All rights reserved.
//
#import <Foundation/Foundation.h>
@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];
@markSci5
markSci5 / ShowTextFieldViewController.m
Created August 29, 2013 03:12
Adjust view to show fields when keyboard appears
#pragma mark - UITextField Delegates
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
self.activeTextField = textField;
}
#pragma mark - Keyboard Notification Methods
@markSci5
markSci5 / transparent_webview
Created August 24, 2013 05:45
Make web view transparent
[webView setBackgroundColor:[UIColor clearColor]];
[webView setOpaque:NO];
@markSci5
markSci5 / assign_weak
Created August 21, 2013 11:00
Assigning ui element to weak property
@property (nonatomic, weak) KGModalContainerView *containerView;
...
-(void)viewDidLoad {
[super viewDidLoad];
KGModalContainerView *myContainerView = [[KGModalContainerView alloc] initWithFrame:containerViewRect]; // This is a strong reference to that view
[self.view addSubview:myContainerView]; //Here self.view retains myContainerView
self.containerView = myContainerView; // Now self.containerView has weak reference to that view, but if your self.view removes this view, self.containerView will automatically go to nil.
// In the end ARC will release myContainerView, but it's retained by self.view and weak referenced by self.containerView
}
@markSci5
markSci5 / progress_navbar
Created August 21, 2013 10:56
Add progress bar to nav bar
- (void)progress:(int)progress withMessage:(NSString*)message {
UIView* v = [[[UIView alloc] init] autorelease];
v.frame = CGRectMake(0, 0, 200, 30);
v.backgroundColor = [UIColor clearColor];
UILabel* lbl = [[[UILabel alloc] init] autorelease];
lbl.frame = CGRectMake(0,0, 200, 15);
lbl.backgroundColor = [UIColor clearColor];
lbl.textColor = [UIColor whiteColor];
lbl.shadowColor = [UIColor colorWithWhite:0 alpha:0.3];
@markSci5
markSci5 / modify_view_nav_bar
Created August 21, 2013 09:14
Modify iOS navigation bar for only one view
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewWillDisappear:animated];
@rogchap
rogchap / RCDropdown.h
Created August 21, 2013 02:58
Simple native iOS dropdown using UITextFiled
#import <UIKit/UIKit.h>
@interface RCDropdown : UITextField
@property (nonatomic) id<UIPickerViewDelegate> pickerDelegate;
@property (nonatomic) id<UIPickerViewDataSource> pickerDataSource;
@end
@markSci5
markSci5 / GCD-background-main-thread
Created August 19, 2013 07:37
GCD background and main thread task
//Start an activity indicator here
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//Call your function or whatever work that needs to be done
//Code in this part is run on a background thread
dispatch_async(dispatch_get_main_queue(), ^(void) {
//Stop your activity indicator or anything else with the GUI
@markSci5
markSci5 / new_gist_file
Created August 19, 2013 05:45
Manual tab switching
// Custom tab bar implementation from http://www.wiredbob.com/2009/04/iphone-tweetie-style//-navigation.html
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
if (item == favouritesTabBarItem) {
UIViewController *fabViewController = [viewControllers objectAtIndex:0];
[self.selectedViewController.view removeFromSuperview];
[self.view addSubview:fabViewController.view];
self.selectedViewController = fabViewController;
} else if (item == moreTabBarItem) {
UIViewController *moreViewController = [viewControllers objectAtIndex:1];