Skip to content

Instantly share code, notes, and snippets.

View SRandazzo's full-sized avatar

Salvatore Randazzo SRandazzo

View GitHub Profile
### Keybase proof
I hereby claim:
* I am srandazzo on github.
* I am srandazzo (https://keybase.io/srandazzo) on keybase.
* I have a public key ASDIq42DzP0hIBzcX2L5LBl0YA7uNhK7061zUTI6Q2H7yQo
To claim this, I am signing this object:
@SRandazzo
SRandazzo / gist:1087885
Created July 17, 2011 18:15
NSString Encoding for Web - iOS
NSString* encodedString = (NSString*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)@"http://yoururl.com/&/?/!", NULL,(CFStringRef)@":/=,!$&'()*+;[]@#?", kCFStringEncodingUTF8);
@SRandazzo
SRandazzo / UIBarButtonItem+CustomBarButton.h
Created July 16, 2011 20:30
Custom UIBarButtonItem for UINavigationBar or UIToolbar
@implementation UIBarButtonItem (CustomBarButton)
+ (UIBarButtonItem*)barItemWithTitle:(NSString *)title backgroundImage:(UIImage *)image target:(id)target action:(SEL)action
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:[image stretchableImageWithLeftCapWidth:8 topCapHeight:0] forState:UIControlStateNormal];
[button setTitle:title forState:UIControlStateNormal];
UIFont *font = [UIFont fontWithName:@"Helvetica-Bold" size:12];
[button.titleLabel setFont:font];
[button.titleLabel setShadowColor:[UIColor whiteColor]];
[button.titleLabel setShadowOffset:CGSizeMake(0, 1)];