Skip to content

Instantly share code, notes, and snippets.

View xr1337's full-sized avatar

Sufiyan Yasa xr1337

View GitHub Profile
@xr1337
xr1337 / gist:5704301
Last active December 18, 2015 01:29
Adding a touch Path
@implementation RoundTouchButton{
CGPathRef touchPath;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
touchPath = CGPathCreateWithEllipseInRect(CGRectMake(0, 0, self.frame.size.width, self.frame.size.height), NULL);
@xr1337
xr1337 / gist:5704189
Created June 4, 2013 07:23
Add Round Touch to View Controller
#import "ViewController.h"
#import "RoundTouchButton.h"
@xr1337
xr1337 / gist:5704267
Last active December 18, 2015 01:29
initialize roundtouchbutton
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
RoundTouchButton *rtb = [[RoundTouchButton alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
rtb.backgroundColor = [UIColor orangeColor];
[rtb addTarget:self action:@selector(rtbTapped) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:rtb];
}
@xr1337
xr1337 / gist:5704176
Last active December 18, 2015 01:29
ViewController 1
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@xr1337
xr1337 / gist:5318147
Created April 5, 2013 10:05
Taken from https://gist.github.com/iangmaia/3368412 and added an ignore to certain URL schemes such as mailto
- (NSArray *) extractLinksFromString:(NSString*)txt ignoreSchemes:(NSArray*)ignoreSchemes{
NSError *error = NULL;
NSDataDetector *detector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:&error];
if (error) return nil;
NSArray *linkMatches = [detector matchesInString:txt options:0 range:NSMakeRange(0, txt.length)];
NSMutableArray *result = [NSMutableArray arrayWithCapacity:[linkMatches count]];