Skip to content

Instantly share code, notes, and snippets.

View jlcampana's full-sized avatar
:octocat:
emu emu emu...

Jose Luis Campaña jlcampana

:octocat:
emu emu emu...
View GitHub Profile
@jlcampana
jlcampana / UIColor+IntegerRGB.h
Created August 21, 2012 10:43
UIColor+IntegerRGB.h
//
// UIColor+IntegerRGB.h
// Shell mPayment
//
// Created by Jose Luis Campaña on 8/21/12.
//
//
#import <UIKit/UIKit.h>
@jlcampana
jlcampana / UIColor+IntegerRGB.m
Created August 21, 2012 10:42
UIColor+IntegerRGB.m
//
// UIColor+IntegerRGB.m
// Shell mPayment
//
// Created by Jose Luis Campaña on 8/21/12.
//
//
#import "UIColor+IntegerRGB.h"
@jlcampana
jlcampana / gist:3377690
Created August 17, 2012 10:11
Customize Navigation Bar
UINavigationBar *navBar = [[self navigationController] navigationBar];
//If we want a custom logo:
UIImage *backgroundImage = [UIImage imageNamed:@"background_im"];
[navBar setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault];
self.navigationItem.titleView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_img"]] autorelease];
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
self.navigationController.navigationItem.backBarButtonItem.tintColor = [UIColor redColor];
self.navigationController.navigationBar.tintColor = [UIColor redColor];
@jlcampana
jlcampana / gist:3377536
Created August 17, 2012 09:49
Hacer n pops en un UINavigationController
+(void)navigationController:(UINavigationController *)navigationController PopNumberOfViews:(NSInteger)numberOfViews
{
NSInteger count = [navigationController.viewControllers count];
UIViewController *vc = [navigationController.viewControllers objectAtIndex:(count - (1 + numberOfViews))];
[navigationController popToViewController:vc animated:YES];
}
@jlcampana
jlcampana / gist:3313284
Created August 10, 2012 10:38
JSON 2 NSDictionary
- (void)apiRequestDone:(ASIHTTPRequest *)request
{
(...)
[NSJSONSerialization JSONObjectWithData:[request responseData] options: NSJSONReadingMutableContainers error:&error]
@jlcampana
jlcampana / gist:3313280
Created August 10, 2012 10:37
JSON (NSDictionary) a String
NSError *error;
NSData *body = [NSJSONSerialization dataWithJSONObject:payJSON options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString = [[NSString alloc] initWithData:body encoding:NSUTF8StringEncoding];
@jlcampana
jlcampana / CWLSynthesizeSingleton.h
Created August 10, 2012 09:44
Clase para crear singletons
//
// CWLSynthesizeSingleton.h
// CocoaWithLove
//
// Created by Matt Gallagher on 2011/08/23.
// Copyright (c) 2011 Matt Gallagher. All rights reserved.
//
// Permission is given to use this source code file, free of charge, in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
@jlcampana
jlcampana / gist:3303027
Created August 9, 2012 10:19
Reverse array
NSArray* reversedArray = [[startArray reverseObjectEnumerator] allObjects];
@jlcampana
jlcampana / gist:3294395
Created August 8, 2012 11:31
ARC Delegate (protocolo)
//.h
@protocol XXXXXXDelegate <NSObject>
@optional
@end
@property (nonatomic, weak) id <XXXXXXDelegate> delegate;
@jlcampana
jlcampana / gist:3293336
Created August 8, 2012 08:07
Rounded navigationBar
CALayer *capa = [self.navigationController navigationBar].layer;
[capa setShadowColor: [[UIColor blackColor] CGColor]];
[capa setShadowOpacity:0.85f];
[capa setShadowOffset: CGSizeMake(0.0f, 1.5f)];
[capa setShadowRadius:2.0f];
[capa setShouldRasterize:YES];
//Round
CGRect bounds = capa.bounds;