Skip to content

Instantly share code, notes, and snippets.

View isutton's full-sized avatar

Igor Sutton isutton

  • Calango Tech B.V.
View GitHub Profile
@isutton
isutton / gist:3075958
Created July 9, 2012 11:33
NSInvocation usage example.
// Omitting the ownership qualification here can lead to a EXC_BAD_ACCESS exception in ARC enabled projects.
__weak id returnValue = nil;
SEL selector = @selector(colorFromString:);
NSString *valueString = @"0.2 0.2 0.2 1.0";
// Create and configure the NSInvocation object.
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[target methodSignatureForSelector:selector]];
invocation.selector = selector;
invocation.target = target;
@isutton
isutton / main.m
Created July 9, 2012 08:51
Regular expressions in Objective-C
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSString *key = @"UINavigationBarTintColor";
NSString *pattern = @"(Color|Font|Height|Width|Size|Origin|Frame)$";
@isutton
isutton / NSString+IARL.h
Created March 14, 2012 22:19
NSString category to return a coordinate from a grid square locator
#import <CoreLocation/CoreLocation.h>
@interface NSString (IARL)
- (CLLocationCoordinate2D)coordinateFromGridSquareLocator;
@end