├── .gitignore ├── Classes ├── FancyLabelAppDelegate.h ├── FancyLabelAppDelegate.m ├── FancyLabelViewController.h ├── FancyLabelViewController.m ├── IFTweetLabel.h ├── IFTweetLabel.m └── RegexKitLite │ ├── .DS_Store │ ├── RKLMatchEnumerator.h │ ├── RKLMatchEnumerator.m │ ├── RegexKitLite.h │ └── RegexKitLite.m ├── FancyLabel.xcodeproj ├── .gitignore ├── project.pbxproj └── project.xcworkspace │ ├── .gitignore │ └── contents.xcworkspacedata ├── FancyLabelViewController.xib ├── FancyLabel_Prefix.pch ├── Info.plist ├── MainWindow.xib └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Classes/.DS_Store 3 | 4 | -------------------------------------------------------------------------------- /Classes/FancyLabelAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // FancyLabelAppDelegate.h 3 | // FancyLabel 4 | // 5 | // Created by Craig Hockenberry on 10/1/08. 6 | // Copyright The Iconfactory 2008. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FancyLabelViewController; 12 | 13 | @interface FancyLabelAppDelegate : NSObject { 14 | UIWindow *window; 15 | FancyLabelViewController *viewController; 16 | } 17 | 18 | @property (nonatomic, retain) IBOutlet UIWindow *window; 19 | @property (nonatomic, retain) IBOutlet FancyLabelViewController *viewController; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /Classes/FancyLabelAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // FancyLabelAppDelegate.m 3 | // FancyLabel 4 | // 5 | // Created by Craig Hockenberry on 10/1/08. 6 | // Copyright The Iconfactory 2008. All rights reserved. 7 | // 8 | 9 | #import "FancyLabelAppDelegate.h" 10 | #import "FancyLabelViewController.h" 11 | 12 | @implementation FancyLabelAppDelegate 13 | 14 | @synthesize window; 15 | @synthesize viewController; 16 | 17 | 18 | - (void)applicationDidFinishLaunching:(UIApplication *)application { 19 | 20 | // Override point for customization after app launch 21 | self.viewController = [[[FancyLabelViewController alloc] init] autorelease]; 22 | 23 | [window addSubview:viewController.view]; 24 | [window makeKeyAndVisible]; 25 | } 26 | 27 | 28 | - (void)dealloc { 29 | [viewController release]; 30 | [window release]; 31 | [super dealloc]; 32 | } 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Classes/FancyLabelViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FancyLabelViewController.h 3 | // FancyLabel 4 | // 5 | // Created by Craig Hockenberry on 10/1/08. 6 | // Copyright The Iconfactory 2008. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "IFTweetLabel.h" 12 | 13 | @interface FancyLabelViewController : UIViewController { 14 | 15 | UILabel *titleLabel; 16 | 17 | IFTweetLabel *tweetLabel; 18 | BOOL linksEnabled; 19 | } 20 | 21 | @property (nonatomic, retain) UILabel *titleLabel; 22 | @property (nonatomic, retain) IFTweetLabel *tweetLabel; 23 | @property (assign) BOOL linksEnabled; 24 | 25 | @end 26 | 27 | -------------------------------------------------------------------------------- /Classes/FancyLabelViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FancyLabelViewController.m 3 | // FancyLabel 4 | // 5 | // Created by Craig Hockenberry on 10/1/08. 6 | // Copyright The Iconfactory 2008. All rights reserved. 7 | // 8 | 9 | #import "FancyLabelViewController.h" 10 | 11 | @implementation FancyLabelViewController 12 | 13 | @synthesize titleLabel; 14 | @synthesize tweetLabel; 15 | @synthesize linksEnabled; 16 | 17 | // Override initWithNibName:bundle: to load the view using a nib file then perform additional customization that is not appropriate for viewDidLoad. 18 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 19 | if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { 20 | // Custom initialization 21 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTweetNotification:) name:IFTweetLabelURLNotification object:nil]; 22 | } 23 | return self; 24 | } 25 | 26 | // Implement loadView to create a view hierarchy programmatically. 27 | - (void)loadView { 28 | 29 | CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame]; 30 | //applicationFrame.origin = CGPointZero; 31 | 32 | UIView *contentView = [[[UIView alloc] initWithFrame:applicationFrame] autorelease]; 33 | 34 | [contentView setBackgroundColor:[UIColor orangeColor]]; 35 | 36 | self.titleLabel = [[[UILabel alloc] initWithFrame:CGRectMake(10.0f, 10.0f, applicationFrame.size.width - 20.0f, 32.0f)] autorelease]; 37 | [self.titleLabel setFont:[UIFont boldSystemFontOfSize:26.0f]]; 38 | [self.titleLabel setTextColor:[UIColor whiteColor]]; 39 | [self.titleLabel setBackgroundColor:[UIColor clearColor]]; 40 | [self.titleLabel setAdjustsFontSizeToFitWidth:YES]; 41 | [self.titleLabel setText:@"Click the Switch Button"]; 42 | [contentView addSubview:self.titleLabel]; 43 | 44 | self.linksEnabled = NO; 45 | 46 | self.tweetLabel = [[[IFTweetLabel alloc] initWithFrame:CGRectMake(10.0f, 50.0f, applicationFrame.size.width - 20.0f, applicationFrame.size.height - 50.0f - 40.0f)] autorelease]; 47 | [self.tweetLabel setFont:[UIFont boldSystemFontOfSize:18.0f]]; 48 | [self.tweetLabel setTextColor:[UIColor whiteColor]]; 49 | [self.tweetLabel setBackgroundColor:[UIColor clearColor]]; 50 | [self.tweetLabel setNumberOfLines:0]; 51 | [self.tweetLabel setText:@"This is a #test of regular expressions with http://example.com links as used in @Twitterrific. HTTP://www.CHOCKLOCK.COM APPROVED OF COURSE. www.a.com www.a.com +21342234 123 123456 1234567"]; 52 | [self.tweetLabel setLinksEnabled:self.linksEnabled]; 53 | [contentView addSubview:self.tweetLabel]; 54 | 55 | CGRect frame = CGRectMake(100.0f, applicationFrame.size.height - 40.0f, applicationFrame.size.width - 200.0f, 22.0f); 56 | UIButton *switchButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; // autoreleased 57 | [switchButton setFrame:frame]; 58 | [switchButton.titleLabel setFont:[UIFont boldSystemFontOfSize:16.0f]]; 59 | [switchButton setTitle:@"Switch" forState:UIControlStateNormal]; 60 | /* 61 | Code like this can be used to customize the buttons that are placed on top of the label: 62 | 63 | [switchButton setTitleColor:[UIColor colorWithRed:0.67f green:0.87f blue:0.96f alpha:1.0f] forState:UIControlStateNormal]; 64 | [switchButton setBackgroundImage:[[UIImage imageNamed:@"link_up.png"] stretchableImageWithLeftCapWidth:11.0f topCapHeight:0.0f] forState:UIControlStateNormal]; 65 | [switchButton setBackgroundImage:[[UIImage imageNamed:@"link_down.png"] stretchableImageWithLeftCapWidth:11.0f topCapHeight:0.0f] forState:UIControlStateHighlighted]; 66 | */ 67 | [switchButton addTarget:self action:@selector(switchLinksEnabled:) forControlEvents:UIControlEventTouchUpInside]; 68 | [contentView addSubview:switchButton]; 69 | 70 | self.view = contentView; 71 | } 72 | 73 | 74 | /* 75 | // Implement viewDidLoad to do additional setup after loading the view. 76 | - (void)viewDidLoad { 77 | [super viewDidLoad]; 78 | } 79 | */ 80 | 81 | 82 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 83 | // Return YES for supported orientations 84 | return (interfaceOrientation == UIInterfaceOrientationPortrait); 85 | } 86 | 87 | 88 | - (void)didReceiveMemoryWarning { 89 | [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview 90 | // Release anything that's not essential, such as cached data 91 | } 92 | 93 | 94 | - (void)dealloc { 95 | [[NSNotificationCenter defaultCenter] removeObserver:self name:IFTweetLabelURLNotification object:nil]; 96 | 97 | [super dealloc]; 98 | } 99 | 100 | - (void)switchLinksEnabled:(id)sender 101 | { 102 | self.linksEnabled = !self.linksEnabled; 103 | 104 | if (self.linksEnabled) 105 | { 106 | [self.titleLabel setText:@"Links are Enabled"]; 107 | } 108 | else 109 | { 110 | [self.titleLabel setText:@"Links are Disabled"]; 111 | } 112 | [self.tweetLabel setLinksEnabled:self.linksEnabled]; 113 | } 114 | 115 | 116 | - (void)handleTweetNotification:(NSNotification *)notification 117 | { 118 | NSLog(@"handleTweetNotification: notification = %@", notification); 119 | } 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /Classes/IFTweetLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // IFTweetLabel.h 3 | // TwitterrificTouch 4 | // 5 | // Created by Craig Hockenberry on 4/2/08. 6 | // Copyright 2008 The Iconfactory. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | extern NSString *IFTweetLabelURLNotification; 12 | 13 | // NOTE: Yeah, it would make more sense to subclass UILabel to do this. But all the 14 | // the UIButtons that got placed on top of the UILabel were not tappable. No amount of 15 | // tinkering with userInteractionEnabled and the responder chain could be found to 16 | // work around this issue. 17 | // 18 | // Instead, a normal view is used and an UILabel methods are supported through forward 19 | // invocation. 20 | 21 | @interface IFTweetLabel : UIView 22 | { 23 | UIColor *normalColor; 24 | UIColor *highlightColor; 25 | 26 | UIImage *normalImage; 27 | UIImage *highlightImage; 28 | 29 | UILabel *label; 30 | 31 | BOOL linksEnabled; 32 | } 33 | 34 | @property (nonatomic, retain) UIColor *normalColor; 35 | @property (nonatomic, retain) UIColor *highlightColor; 36 | 37 | @property (nonatomic, retain) UIImage *normalImage; 38 | @property (nonatomic, retain) UIImage *highlightImage; 39 | 40 | @property (nonatomic, retain) UILabel *label; 41 | 42 | @property (nonatomic, assign) BOOL linksEnabled; 43 | 44 | - (void)setBackgroundColor:(UIColor *)backgroundColor; 45 | - (void)setFrame:(CGRect)frame; 46 | 47 | @end 48 | 49 | 50 | @interface IFTweetLabel (ForwardInvocation) 51 | 52 | @property(nonatomic, copy) NSString *text; 53 | @property(nonatomic) NSInteger numberOfLines; 54 | @property(nonatomic, retain) UIColor *textColor; 55 | @property(nonatomic, retain) UIFont *font; 56 | 57 | @end -------------------------------------------------------------------------------- /Classes/IFTweetLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // IFTweetLabel.m 3 | // TwitterrificTouch 4 | // 5 | // Created by Craig Hockenberry on 4/2/08. 6 | // Copyright 2008 The Iconfactory. All rights reserved. 7 | // 8 | 9 | #import "IFTweetLabel.h" 10 | #import "RegexKitLite.h" 11 | #import "RKLMatchEnumerator.h" 12 | 13 | #define DRAW_DEBUG_FRAMES 0 14 | 15 | 16 | @implementation IFTweetLabel 17 | 18 | @synthesize normalColor; 19 | @synthesize highlightColor; 20 | 21 | @synthesize normalImage; 22 | @synthesize highlightImage; 23 | 24 | @synthesize label; 25 | 26 | @synthesize linksEnabled; 27 | 28 | 29 | NSString *IFTweetLabelURLNotification = @"IFTweetLabelURLNotification"; 30 | 31 | 32 | static NSArray *expressions = nil; 33 | 34 | + (void)initialize 35 | { 36 | // setup regular expressions that define where buttons will be created 37 | expressions = [[NSArray alloc] initWithObjects: 38 | @"(\\+)?([0-9]{8,}+)", // phone numbers, 8 or more 39 | @"(@[a-zA-Z0-9_]+)", // screen names 40 | @"(#[a-zA-Z0-9_-]+)", // hash tags 41 | @"([hH][tT][tT][pP][sS]?:\\/\\/[^ ,'\">\\]\\)]*[^\\. ,'\">\\]\\)])", // hyperlinks with http:// 42 | @"[wW][wW][wW].([a-z]|[A-Z]|[0-9]|[/.]|[~])*", // hyperlinks like www.something.tld 43 | nil]; 44 | } 45 | 46 | - (void)handleButton:(id)sender 47 | { 48 | NSString *buttonTitle = [sender titleForState:UIControlStateNormal]; 49 | //NSLog(@"IFTweetLabel: handleButton: sender = %@, title = %@", sender, buttonTitle); 50 | 51 | NSString *text = self.label.text; 52 | 53 | // NOTE: It's possible that the button title only includes the beginning of screen name or hyperlink. 54 | // This code collects all possible links in the current label text and gets a full match that can be passed 55 | // with the notification. 56 | 57 | for (NSString *expression in expressions) 58 | { 59 | NSString *match; 60 | NSEnumerator *enumerator = [text matchEnumeratorWithRegex:expression]; 61 | while (match = [enumerator nextObject]) 62 | { 63 | if ([match hasPrefix:buttonTitle]) 64 | { 65 | [[NSNotificationCenter defaultCenter] postNotificationName:IFTweetLabelURLNotification object:match]; 66 | } 67 | } 68 | } 69 | } 70 | 71 | - (void)createButtonWithText:(NSString *)text withFrame:(CGRect)frame 72 | { 73 | UIButton *button = nil; 74 | if (self.normalImage && self.highlightImage) 75 | { 76 | button = [UIButton buttonWithType:UIButtonTypeCustom]; // autoreleased 77 | [button setBackgroundImage:self.normalImage forState:UIControlStateNormal]; 78 | [button setBackgroundImage:self.highlightImage forState:UIControlStateHighlighted]; 79 | } 80 | else 81 | { 82 | button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; // autoreleased 83 | } 84 | [button setFrame:frame]; 85 | [button.titleLabel setFont:self.label.font]; 86 | [button setTitle:text forState:UIControlStateNormal]; 87 | [button.titleLabel setLineBreakMode:[self.label lineBreakMode]]; 88 | [button setTitleColor:self.normalColor forState:UIControlStateNormal]; 89 | [button setTitleColor:self.highlightColor forState:UIControlStateHighlighted]; 90 | [button addTarget:self action:@selector(handleButton:) forControlEvents:UIControlEventTouchUpInside]; 91 | [self addSubview:button]; 92 | } 93 | 94 | 95 | - (void)createButtonsWithText:(NSString *)text atPoint:(CGPoint)point 96 | { 97 | //NSLog(@"output = '%@', point = %@", text, NSStringFromCGPoint(point)); 98 | 99 | UIFont *font = self.label.font; 100 | 101 | // keep an array of already parsed substrings of the current line of text 102 | // (if we get more than 16 matches this is going to crash) 103 | NSRange parsedRanges[16]; 104 | NSInteger parsedRangesLength = 0; 105 | 106 | // take each of the regular expressions that we defined and try to match it within the text 107 | for (NSString *expression in expressions) 108 | { 109 | NSString *match; 110 | NSEnumerator *enumerator = [text matchEnumeratorWithRegex:expression]; 111 | 112 | // go through all the matches and weed out overlapping ones in the process 113 | while (match = [enumerator nextObject]) 114 | { 115 | // compute the size of the matched string 116 | CGSize matchSize = [match sizeWithFont:font]; 117 | 118 | NSRange matchRange; 119 | NSInteger startingLocation = 0; 120 | BOOL matchAlreadyHandled = NO; 121 | 122 | // in a gist, the while below will keep trying to match a substring if it hasn't been matched yet 123 | // this prevents double-matching an url like www.a.com if http://www.a.com was already matched 124 | // this also allows the engine to match a string like 'www.a.com www.a.com' 125 | while (true) { 126 | // find the first match in our text 127 | matchRange = [text rangeOfString:match options:0 range:NSMakeRange(startingLocation, [text length] - startingLocation)]; 128 | 129 | // check if the match's range overlaps any of the previously handled matches 130 | BOOL isOverlapping = NO; 131 | for (int i=0; i < parsedRangesLength; i++) 132 | { 133 | NSRange aRange = parsedRanges[i]; 134 | if (NSIntersectionRange(aRange, matchRange).length != 0) 135 | { 136 | // the match overlaps, therefore move the caret to the right 137 | startingLocation = matchRange.location + matchRange.length; 138 | isOverlapping = YES; 139 | break; 140 | } 141 | } 142 | if (isOverlapping) 143 | { 144 | if (startingLocation >= [text length]) 145 | { 146 | // we are at the end of our string therefore we have exhausted all chances to match it 147 | matchAlreadyHandled = YES; 148 | break; 149 | } 150 | } 151 | else 152 | { 153 | break; 154 | } 155 | } 156 | if (matchAlreadyHandled) 157 | { 158 | continue; 159 | } 160 | 161 | NSRange measureRange = NSMakeRange(0, matchRange.location); 162 | // take the string that precedes the match 163 | NSString *measureText = [text substringWithRange:measureRange]; 164 | // compute the size of the string that precedes the match 165 | CGSize measureSize = [measureText sizeWithFont:font]; 166 | 167 | // compute the frame of the matched text 168 | CGRect matchFrame = CGRectMake(measureSize.width - 3.0f, point.y, matchSize.width + 6.0f, matchSize.height); 169 | [self createButtonWithText:match withFrame:matchFrame]; 170 | 171 | parsedRanges[parsedRangesLength] = matchRange; 172 | parsedRangesLength++; 173 | //NSLog(@"match = %@", match); 174 | } 175 | } 176 | } 177 | 178 | // NOTE: It seems that UILabel doesn't break at whitespace if it's at the beginning of the line. This value is a total fricken' guess. 179 | #define MIN_WHITESPACE_LOCATION 5 180 | 181 | - (void)createButtons 182 | { 183 | CGRect frame = self.frame; 184 | if (frame.size.width == 0.0f || frame.size.height == 0.0f) 185 | { 186 | return; 187 | } 188 | 189 | UIFont *font = self.label.font; 190 | 191 | 192 | NSString *text = self.label.text; 193 | NSUInteger textLength = [text length]; 194 | 195 | // by default, the output starts at the top of the frame 196 | CGPoint outputPoint = CGPointZero; 197 | CGSize textSize = [text sizeWithFont:font constrainedToSize:frame.size]; 198 | CGRect bounds = [self bounds]; 199 | if (textSize.height < bounds.size.height) 200 | { 201 | // the lines of text are centered in the bounds, so adjust the output point 202 | CGFloat boundsMidY = CGRectGetMidY(bounds); 203 | CGFloat textMidY = textSize.height / 2.0; 204 | outputPoint.y = ceilf(boundsMidY - textMidY); 205 | } 206 | 207 | 208 | //NSLog(@"****** text = '%@'", text); 209 | 210 | // initialize whitespace tracking 211 | BOOL scanningWhitespace = NO; 212 | NSRange whitespaceRange = NSMakeRange(NSNotFound, 0); 213 | 214 | // scan the text 215 | NSRange scanRange = NSMakeRange(0, 1); 216 | while (NSMaxRange(scanRange) < textLength) 217 | { 218 | NSRange tokenRange = NSMakeRange(NSMaxRange(scanRange) - 1, 1); 219 | NSString *token = [text substringWithRange:tokenRange]; 220 | 221 | #if 0 222 | // debug bytes in token 223 | char buffer[10]; 224 | NSUInteger usedLength; 225 | [token getBytes:&buffer maxLength:10 usedLength:&usedLength encoding:NSUTF8StringEncoding options:0 range:NSMakeRange(0, [token length]) remainingRange:NULL]; 226 | NSUInteger index; 227 | for (index = 0; index < usedLength; index++) 228 | { 229 | NSLog(@"token: %3d 0x%02x", tokenRange.location, buffer[index] & 0xff); 230 | } 231 | #endif 232 | 233 | if ([token isEqualToString:@" "] || [token isEqualToString:@"?"] || [token isEqualToString:@"-"]) 234 | { 235 | //NSLog(@"------ whitespace: token = '%@'", token); 236 | 237 | // handle whitespace 238 | if (! scanningWhitespace) 239 | { 240 | // start of whitespace 241 | whitespaceRange.location = tokenRange.location; 242 | whitespaceRange.length = 1; 243 | } 244 | else 245 | { 246 | // continuing whitespace 247 | whitespaceRange.length += 1; 248 | } 249 | 250 | scanningWhitespace = YES; 251 | 252 | // scan the next position 253 | scanRange.length += 1; 254 | } 255 | else 256 | { 257 | // end of whitespace 258 | scanningWhitespace = NO; 259 | 260 | NSString *scanText = [text substringWithRange:scanRange]; 261 | CGSize currentSize = [scanText sizeWithFont:font]; 262 | 263 | BOOL breakLine = NO; 264 | if ([token isEqualToString:@"\r"] || [token isEqualToString:@"\n"]) 265 | { 266 | // carriage return or newline caused line to break 267 | //NSLog(@"------ scanText = '%@', token = '%@'", scanText, token); 268 | breakLine = YES; 269 | } 270 | BOOL breakWidth = NO; 271 | if (currentSize.width > frame.size.width) 272 | { 273 | // the width of the text in the frame caused the line to break 274 | //NSLog(@"------ scanText = '%@', currentSize = %@", scanText, NSStringFromCGSize(currentSize)); 275 | breakWidth = YES; 276 | } 277 | 278 | if (breakLine || breakWidth) 279 | { 280 | // the line broke, compute the range of text we want to output 281 | NSRange outputRange; 282 | 283 | if (breakLine) 284 | { 285 | // output before the token that broke the line 286 | outputRange.location = scanRange.location; 287 | outputRange.length = tokenRange.location - scanRange.location; 288 | } 289 | else 290 | { 291 | if (whitespaceRange.location != NSNotFound && whitespaceRange.location > MIN_WHITESPACE_LOCATION) 292 | { 293 | // output before beginning of the last whitespace 294 | outputRange.location = scanRange.location; 295 | outputRange.length = whitespaceRange.location - scanRange.location; 296 | } 297 | else 298 | { 299 | // output before the token that cause width overflow 300 | outputRange.location = scanRange.location; 301 | outputRange.length = tokenRange.location - scanRange.location; 302 | } 303 | } 304 | 305 | // make the buttons in this line of text 306 | [self createButtonsWithText:[text substringWithRange:outputRange] atPoint:outputPoint]; 307 | 308 | if (breakLine) 309 | { 310 | // start scanning after token that broke the line 311 | scanRange.location = NSMaxRange(tokenRange); 312 | scanRange.length = 1; 313 | } 314 | else 315 | { 316 | if (whitespaceRange.location != NSNotFound && whitespaceRange.location > MIN_WHITESPACE_LOCATION) 317 | { 318 | // start scanning at end of last whitespace 319 | scanRange.location = NSMaxRange(whitespaceRange); 320 | scanRange.length = 1; 321 | } 322 | else 323 | { 324 | // start scanning at token that cause width overflow 325 | scanRange.location = NSMaxRange(tokenRange) - 1; 326 | scanRange.length = 1; 327 | } 328 | } 329 | 330 | // reset whitespace 331 | whitespaceRange.location = NSNotFound; 332 | whitespaceRange.length = 0; 333 | 334 | // move output to next line 335 | outputPoint.y += currentSize.height; 336 | } 337 | else 338 | { 339 | // the line did not break, scan the next position 340 | scanRange.length += 1; 341 | } 342 | } 343 | } 344 | 345 | // output to end 346 | [self createButtonsWithText:[text substringFromIndex:scanRange.location] atPoint:outputPoint];; 347 | } 348 | 349 | - (void)removeButtons 350 | { 351 | UIView *view; 352 | for (view in [self subviews]) 353 | { 354 | if ([view isKindOfClass:[UIButton class]]) 355 | { 356 | [view removeFromSuperview]; 357 | } 358 | } 359 | } 360 | 361 | 362 | - (id)initWithFrame:(CGRect)frame 363 | { 364 | if (self = [super initWithFrame:frame]) 365 | { 366 | self.clipsToBounds = YES; 367 | 368 | self.normalColor = [UIColor blueColor]; 369 | self.highlightColor = [UIColor redColor]; 370 | 371 | self.normalImage = nil; 372 | self.highlightImage = nil; 373 | 374 | self.label = [[[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, frame.size.width, frame.size.height)] autorelease]; 375 | [self addSubview:self.label]; 376 | 377 | self.linksEnabled = NO; 378 | } 379 | 380 | return self; 381 | } 382 | 383 | - (void)dealloc 384 | { 385 | self.normalColor = nil; 386 | self.highlightColor = nil; 387 | 388 | self.normalImage = nil; 389 | self.highlightImage = nil; 390 | 391 | [self removeButtons]; 392 | 393 | [super dealloc]; 394 | } 395 | 396 | 397 | - (void)layoutSubviews 398 | { 399 | [super layoutSubviews]; 400 | 401 | [self removeButtons]; 402 | if (linksEnabled) 403 | { 404 | [self createButtons]; 405 | } 406 | 407 | #if DRAW_DEBUG_FRAMES 408 | [self setNeedsDisplay]; 409 | #endif 410 | } 411 | 412 | #if DRAW_DEBUG_FRAMES 413 | - (void)drawRect:(CGRect)rect 414 | { 415 | [[UIColor whiteColor] set]; 416 | UIRectFrame([self bounds]); 417 | 418 | UIView *view; 419 | for (view in [self subviews]) 420 | { 421 | if ([view isKindOfClass:[UIButton class]]) 422 | { 423 | [[UIColor redColor] set]; 424 | UIRectFrame([view frame]); 425 | } 426 | else if ([view isKindOfClass:[UILabel class]]) 427 | { 428 | [[UIColor greenColor] set]; 429 | UIRectFrame([view frame]); 430 | } 431 | } 432 | } 433 | #endif 434 | 435 | 436 | - (void)setText:(NSString *)text 437 | { 438 | [self.label setText:text]; 439 | 440 | [self setNeedsLayout]; 441 | } 442 | 443 | - (void)setLinksEnabled:(BOOL)state 444 | { 445 | if (linksEnabled != state) 446 | { 447 | linksEnabled = state; 448 | 449 | [self setNeedsLayout]; 450 | } 451 | } 452 | 453 | // handle methods that affect both this view and label view 454 | 455 | - (void)setBackgroundColor:(UIColor *)backgroundColor 456 | { 457 | [super setBackgroundColor:backgroundColor]; 458 | [self.label setBackgroundColor:backgroundColor]; 459 | } 460 | 461 | - (void)setFrame:(CGRect)frame; 462 | { 463 | [super setFrame:frame]; 464 | [self.label setFrame:CGRectMake(0.0f, 0.0f, frame.size.width, frame.size.height)]; 465 | } 466 | 467 | // forward methods that are not handled by the super class to the label view 468 | 469 | - (void)forwardInvocation:(NSInvocation*)invocation 470 | { 471 | SEL aSelector = [invocation selector]; 472 | 473 | //NSLog(@"forwardInvocation: selector = %@", NSStringFromSelector(aSelector)); 474 | 475 | if ([self.label respondsToSelector:aSelector]) 476 | { 477 | [invocation invokeWithTarget:self.label]; 478 | } 479 | else 480 | { 481 | [self doesNotRecognizeSelector:aSelector]; 482 | } 483 | } 484 | 485 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 486 | { 487 | //NSLog(@"methodSignatureForSelector: selector = %@", NSStringFromSelector(aSelector)); 488 | 489 | NSMethodSignature* methodSignature = [super methodSignatureForSelector:aSelector]; 490 | if (methodSignature == nil) 491 | { 492 | methodSignature = [self.label methodSignatureForSelector:aSelector]; 493 | } 494 | 495 | return methodSignature; 496 | } 497 | 498 | - (BOOL)respondsToSelector:(SEL)aSelector 499 | { 500 | //NSLog(@"respondsToSelector: selector = %@", NSStringFromSelector(aSelector)); 501 | 502 | return [super respondsToSelector:aSelector] || [self.label respondsToSelector:aSelector]; 503 | } 504 | 505 | @end 506 | -------------------------------------------------------------------------------- /Classes/RegexKitLite/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alinradut/IFTweetLabel/f7b3bc9f98e26ed1a30218cecd1c6ae208f10267/Classes/RegexKitLite/.DS_Store -------------------------------------------------------------------------------- /Classes/RegexKitLite/RKLMatchEnumerator.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @interface NSString (RegexKitLiteEnumeratorAdditions) 6 | - (NSEnumerator *)matchEnumeratorWithRegex:(NSString *)regex; 7 | @end 8 | -------------------------------------------------------------------------------- /Classes/RegexKitLite/RKLMatchEnumerator.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "RegexKitLite.h" 4 | #import "RKLMatchEnumerator.h" 5 | 6 | @interface RKLMatchEnumerator : NSEnumerator { 7 | NSString *string; 8 | NSString *regex; 9 | NSUInteger location; 10 | } 11 | 12 | - (id)initWithString:(NSString *)initString regex:(NSString *)initRegex; 13 | 14 | @end 15 | 16 | @implementation RKLMatchEnumerator 17 | 18 | - (id)initWithString:(NSString *)initString regex:(NSString *)initRegex 19 | { 20 | if((self = [self init]) == NULL) { return(NULL); } 21 | string = [initString copy]; 22 | regex = [initRegex copy]; 23 | return(self); 24 | } 25 | 26 | - (id)nextObject 27 | { 28 | if(location != NSNotFound) { 29 | NSRange searchRange = NSMakeRange(location, [string length] - location); 30 | NSRange matchedRange = [string rangeOfRegex:regex inRange:searchRange]; 31 | 32 | location = NSMaxRange(matchedRange) + ((matchedRange.length == 0) ? 1 : 0); 33 | 34 | if(matchedRange.location != NSNotFound) { 35 | return([string substringWithRange:matchedRange]); 36 | } 37 | } 38 | return(NULL); 39 | } 40 | 41 | - (void) dealloc 42 | { 43 | [string release]; 44 | [regex release]; 45 | [super dealloc]; 46 | } 47 | 48 | @end 49 | 50 | @implementation NSString (RegexKitLiteEnumeratorAdditions) 51 | 52 | - (NSEnumerator *)matchEnumeratorWithRegex:(NSString *)regex 53 | { 54 | return([[[RKLMatchEnumerator alloc] initWithString:self regex:regex] autorelease]); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Classes/RegexKitLite/RegexKitLite.h: -------------------------------------------------------------------------------- 1 | // 2 | // RegexKitLite.h 3 | // http://regexkit.sourceforge.net/ 4 | // Licensed under the terms of the BSD License, as specified below. 5 | // 6 | 7 | /* 8 | Copyright (c) 2008-2010, John Engelhart 9 | 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | * Redistributions of source code must retain the above copyright 16 | notice, this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name of the Zang Industries nor the names of its 23 | contributors may be used to endorse or promote products derived from 24 | this software without specific prior written permission. 25 | 26 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 32 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 34 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | 39 | #ifdef __OBJC__ 40 | #import 41 | #import 42 | #import 43 | #import 44 | #import 45 | #endif // __OBJC__ 46 | 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | #ifndef REGEXKITLITE_VERSION_DEFINED 58 | #define REGEXKITLITE_VERSION_DEFINED 59 | 60 | #define _RKL__STRINGIFY(b) #b 61 | #define _RKL_STRINGIFY(a) _RKL__STRINGIFY(a) 62 | #define _RKL_JOIN_VERSION(a,b) _RKL_STRINGIFY(a##.##b) 63 | #define _RKL_VERSION_STRING(a,b) _RKL_JOIN_VERSION(a,b) 64 | 65 | #define REGEXKITLITE_VERSION_MAJOR 4 66 | #define REGEXKITLITE_VERSION_MINOR 0 67 | 68 | #define REGEXKITLITE_VERSION_CSTRING _RKL_VERSION_STRING(REGEXKITLITE_VERSION_MAJOR, REGEXKITLITE_VERSION_MINOR) 69 | #define REGEXKITLITE_VERSION_NSSTRING @REGEXKITLITE_VERSION_CSTRING 70 | 71 | #endif // REGEXKITLITE_VERSION_DEFINED 72 | 73 | #if !defined(RKL_BLOCKS) && defined(NS_BLOCKS_AVAILABLE) && (NS_BLOCKS_AVAILABLE == 1) 74 | #define RKL_BLOCKS 1 75 | #endif 76 | 77 | #if defined(RKL_BLOCKS) && (RKL_BLOCKS == 1) 78 | #define _RKL_BLOCKS_ENABLED 1 79 | #endif // defined(RKL_BLOCKS) && (RKL_BLOCKS == 1) 80 | 81 | #if defined(_RKL_BLOCKS_ENABLED) && !defined(__BLOCKS__) 82 | #warning RegexKitLite support for Blocks is enabled, but __BLOCKS__ is not defined. This compiler may not support Blocks, in which case the behavior is undefined. This will probably cause numerous compiler errors. 83 | #endif // defined(_RKL_BLOCKS_ENABLED) && !defined(__BLOCKS__) 84 | 85 | // For Mac OS X < 10.5. 86 | #ifndef NSINTEGER_DEFINED 87 | #define NSINTEGER_DEFINED 88 | #if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) 89 | typedef long NSInteger; 90 | typedef unsigned long NSUInteger; 91 | #define NSIntegerMin LONG_MIN 92 | #define NSIntegerMax LONG_MAX 93 | #define NSUIntegerMax ULONG_MAX 94 | #else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) 95 | typedef int NSInteger; 96 | typedef unsigned int NSUInteger; 97 | #define NSIntegerMin INT_MIN 98 | #define NSIntegerMax INT_MAX 99 | #define NSUIntegerMax UINT_MAX 100 | #endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) 101 | #endif // NSINTEGER_DEFINED 102 | 103 | #ifndef RKLREGEXOPTIONS_DEFINED 104 | #define RKLREGEXOPTIONS_DEFINED 105 | 106 | // These must be identical to their ICU regex counterparts. See http://www.icu-project.org/userguide/regexp.html 107 | enum { 108 | RKLNoOptions = 0, 109 | RKLCaseless = 2, 110 | RKLComments = 4, 111 | RKLDotAll = 32, 112 | RKLMultiline = 8, 113 | RKLUnicodeWordBoundaries = 256 114 | }; 115 | typedef uint32_t RKLRegexOptions; // This must be identical to the ICU 'flags' argument type. 116 | 117 | #endif // RKLREGEXOPTIONS_DEFINED 118 | 119 | #ifndef RKLREGEXENUMERATIONOPTIONS_DEFINED 120 | #define RKLREGEXENUMERATIONOPTIONS_DEFINED 121 | 122 | enum { 123 | RKLRegexEnumerationNoOptions = 0UL, 124 | RKLRegexEnumerationCapturedStringsNotRequired = 1UL << 9, 125 | RKLRegexEnumerationReleaseStringReturnedByReplacementBlock = 1UL << 10, 126 | RKLRegexEnumerationFastCapturedStringsXXX = 1UL << 11, 127 | }; 128 | typedef NSUInteger RKLRegexEnumerationOptions; 129 | 130 | #endif // RKLREGEXENUMERATIONOPTIONS_DEFINED 131 | 132 | #ifndef _REGEXKITLITE_H_ 133 | #define _REGEXKITLITE_H_ 134 | 135 | #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465) 136 | #define RKL_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) 137 | #else 138 | #define RKL_DEPRECATED_ATTRIBUTE 139 | #endif 140 | 141 | #if defined(NS_REQUIRES_NIL_TERMINATION) 142 | #define RKL_REQUIRES_NIL_TERMINATION NS_REQUIRES_NIL_TERMINATION 143 | #else // defined(NS_REQUIRES_NIL_TERMINATION) 144 | #define RKL_REQUIRES_NIL_TERMINATION 145 | #endif // defined(NS_REQUIRES_NIL_TERMINATION) 146 | 147 | // This requires a few levels of rewriting to get the desired results. 148 | #define _RKL_CONCAT_2(c,d) c ## d 149 | #define _RKL_CONCAT(a,b) _RKL_CONCAT_2(a,b) 150 | 151 | #ifdef RKL_PREPEND_TO_METHODS 152 | #define RKL_METHOD_PREPEND(x) _RKL_CONCAT(RKL_PREPEND_TO_METHODS, x) 153 | #else // RKL_PREPEND_TO_METHODS 154 | #define RKL_METHOD_PREPEND(x) x 155 | #endif // RKL_PREPEND_TO_METHODS 156 | 157 | // If it looks like low memory notifications might be available, add code to register and respond to them. 158 | // This is (should be) harmless if it turns out that this isn't the case, since the notification that we register for, 159 | // UIApplicationDidReceiveMemoryWarningNotification, is dynamically looked up via dlsym(). 160 | #if ((defined(TARGET_OS_EMBEDDED) && (TARGET_OS_EMBEDDED != 0)) || (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0))) && (!defined(RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS) || (RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS != 0)) 161 | #define RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS 1 162 | #endif 163 | 164 | #ifdef __OBJC__ 165 | 166 | // NSException exception name. 167 | extern NSString * const RKLICURegexException; 168 | 169 | // NSError error domains and user info keys. 170 | extern NSString * const RKLICURegexErrorDomain; 171 | 172 | extern NSString * const RKLICURegexEnumerationOptionsErrorKey; 173 | extern NSString * const RKLICURegexErrorCodeErrorKey; 174 | extern NSString * const RKLICURegexErrorNameErrorKey; 175 | extern NSString * const RKLICURegexLineErrorKey; 176 | extern NSString * const RKLICURegexOffsetErrorKey; 177 | extern NSString * const RKLICURegexPreContextErrorKey; 178 | extern NSString * const RKLICURegexPostContextErrorKey; 179 | extern NSString * const RKLICURegexRegexErrorKey; 180 | extern NSString * const RKLICURegexRegexOptionsErrorKey; 181 | extern NSString * const RKLICURegexReplacedCountErrorKey; 182 | extern NSString * const RKLICURegexReplacedStringErrorKey; 183 | extern NSString * const RKLICURegexReplacementStringErrorKey; 184 | extern NSString * const RKLICURegexSubjectRangeErrorKey; 185 | extern NSString * const RKLICURegexSubjectStringErrorKey; 186 | 187 | @interface NSString (RegexKitLiteAdditions) 188 | 189 | + (void)RKL_METHOD_PREPEND(clearStringCache); 190 | 191 | // Although these are marked as deprecated, a bug in GCC prevents a warning from being issues for + class methods. Filed bug with Apple, #6736857. 192 | + (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex RKL_DEPRECATED_ATTRIBUTE; 193 | + (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex options:(RKLRegexOptions)options error:(NSError **)error RKL_DEPRECATED_ATTRIBUTE; 194 | 195 | - (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex; 196 | - (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex range:(NSRange)range; 197 | - (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; 198 | 199 | - (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex; 200 | - (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex inRange:(NSRange)range; 201 | - (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error; 202 | 203 | - (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex; 204 | - (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex capture:(NSInteger)capture; 205 | - (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex inRange:(NSRange)range; 206 | - (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; 207 | 208 | - (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex; 209 | - (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex capture:(NSInteger)capture; 210 | - (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex inRange:(NSRange)range; 211 | - (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; 212 | 213 | - (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement; 214 | - (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange; 215 | - (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error; 216 | 217 | //// >= 3.0 218 | 219 | - (NSInteger)RKL_METHOD_PREPEND(captureCount); 220 | - (NSInteger)RKL_METHOD_PREPEND(captureCountWithOptions):(RKLRegexOptions)options error:(NSError **)error; 221 | 222 | - (BOOL)RKL_METHOD_PREPEND(isRegexValid); 223 | - (BOOL)RKL_METHOD_PREPEND(isRegexValidWithOptions):(RKLRegexOptions)options error:(NSError **)error; 224 | 225 | - (void)RKL_METHOD_PREPEND(flushCachedRegexData); 226 | 227 | - (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex; 228 | - (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex capture:(NSInteger)capture; 229 | - (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex range:(NSRange)range; 230 | - (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; 231 | 232 | 233 | - (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex; 234 | - (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range; 235 | - (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; 236 | 237 | - (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex; 238 | - (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range; 239 | - (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; 240 | 241 | //// >= 4.0 242 | 243 | - (NSArray *)RKL_METHOD_PREPEND(arrayOfDictionariesByMatchingRegex):(NSString *)regex withKeysAndCaptures:(id)firstKey, ... RKL_REQUIRES_NIL_TERMINATION; 244 | - (NSArray *)RKL_METHOD_PREPEND(arrayOfDictionariesByMatchingRegex):(NSString *)regex range:(NSRange)range withKeysAndCaptures:(id)firstKey, ... RKL_REQUIRES_NIL_TERMINATION; 245 | - (NSArray *)RKL_METHOD_PREPEND(arrayOfDictionariesByMatchingRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error withKeysAndCaptures:(id)firstKey, ... RKL_REQUIRES_NIL_TERMINATION; 246 | - (NSArray *)RKL_METHOD_PREPEND(arrayOfDictionariesByMatchingRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error withFirstKey:(id)firstKey arguments:(va_list)varArgsList; 247 | 248 | - (NSArray *)RKL_METHOD_PREPEND(arrayOfDictionariesByMatchingRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error withKeys:(id *)keys forCaptures:(int *)captures count:(NSUInteger)count; 249 | 250 | - (NSDictionary *)RKL_METHOD_PREPEND(dictionaryByMatchingRegex):(NSString *)regex withKeysAndCaptures:(id)firstKey, ... RKL_REQUIRES_NIL_TERMINATION; 251 | - (NSDictionary *)RKL_METHOD_PREPEND(dictionaryByMatchingRegex):(NSString *)regex range:(NSRange)range withKeysAndCaptures:(id)firstKey, ... RKL_REQUIRES_NIL_TERMINATION; 252 | - (NSDictionary *)RKL_METHOD_PREPEND(dictionaryByMatchingRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error withKeysAndCaptures:(id)firstKey, ... RKL_REQUIRES_NIL_TERMINATION; 253 | - (NSDictionary *)RKL_METHOD_PREPEND(dictionaryByMatchingRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error withFirstKey:(id)firstKey arguments:(va_list)varArgsList; 254 | 255 | - (NSDictionary *)RKL_METHOD_PREPEND(dictionaryByMatchingRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error withKeys:(id *)keys forCaptures:(int *)captures count:(NSUInteger)count; 256 | 257 | #ifdef _RKL_BLOCKS_ENABLED 258 | 259 | - (BOOL)RKL_METHOD_PREPEND(enumerateStringsMatchedByRegex):(NSString *)regex usingBlock:(void (^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block; 260 | - (BOOL)RKL_METHOD_PREPEND(enumerateStringsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error enumerationOptions:(RKLRegexEnumerationOptions)enumerationOptions usingBlock:(void (^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block; 261 | 262 | - (BOOL)RKL_METHOD_PREPEND(enumerateStringsSeparatedByRegex):(NSString *)regex usingBlock:(void (^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block; 263 | - (BOOL)RKL_METHOD_PREPEND(enumerateStringsSeparatedByRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error enumerationOptions:(RKLRegexEnumerationOptions)enumerationOptions usingBlock:(void (^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block; 264 | 265 | - (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex usingBlock:(NSString *(^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block; 266 | - (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error enumerationOptions:(RKLRegexEnumerationOptions)enumerationOptions usingBlock:(NSString *(^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block; 267 | 268 | #endif // _RKL_BLOCKS_ENABLED 269 | 270 | @end 271 | 272 | @interface NSMutableString (RegexKitLiteAdditions) 273 | 274 | - (NSInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement; 275 | - (NSInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange; 276 | - (NSInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error; 277 | 278 | //// >= 4.0 279 | 280 | #ifdef _RKL_BLOCKS_ENABLED 281 | 282 | - (NSInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex usingBlock:(NSString *(^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block; 283 | - (NSInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error enumerationOptions:(RKLRegexEnumerationOptions)enumerationOptions usingBlock:(NSString *(^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block; 284 | 285 | #endif // _RKL_BLOCKS_ENABLED 286 | 287 | @end 288 | 289 | #endif // __OBJC__ 290 | 291 | #endif // _REGEXKITLITE_H_ 292 | 293 | #ifdef __cplusplus 294 | } // extern "C" 295 | #endif 296 | -------------------------------------------------------------------------------- /FancyLabel.xcodeproj/.gitignore: -------------------------------------------------------------------------------- 1 | xcuserdata 2 | -------------------------------------------------------------------------------- /FancyLabel.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* FancyLabelAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* FancyLabelAppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 15 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 16 | 28D7ACF80DDB3853001CB0EB /* FancyLabelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* FancyLabelViewController.m */; }; 17 | 44A1275A0E9449BE002E46EA /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = 44A127550E9449BE002E46EA /* RegexKitLite.m */; }; 18 | 44A1275B0E9449BE002E46EA /* RKLMatchEnumerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 44A127570E9449BE002E46EA /* RKLMatchEnumerator.m */; }; 19 | 44A1275C0E9449BE002E46EA /* IFTweetLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 44A127580E9449BE002E46EA /* IFTweetLabel.m */; }; 20 | 44A127650E9449FA002E46EA /* libicucore.A.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 44A127640E9449FA002E46EA /* libicucore.A.dylib */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 25 | 1D3623240D0F684500981E51 /* FancyLabelAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FancyLabelAppDelegate.h; sourceTree = ""; }; 26 | 1D3623250D0F684500981E51 /* FancyLabelAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FancyLabelAppDelegate.m; sourceTree = ""; }; 27 | 1D6058910D05DD3D006BFB54 /* FancyLabel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FancyLabel.app; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 29 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 30 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 31 | 28D7ACF60DDB3853001CB0EB /* FancyLabelViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FancyLabelViewController.h; sourceTree = ""; }; 32 | 28D7ACF70DDB3853001CB0EB /* FancyLabelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FancyLabelViewController.m; sourceTree = ""; }; 33 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | 32CA4F630368D1EE00C91783 /* FancyLabel_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FancyLabel_Prefix.pch; sourceTree = ""; }; 35 | 44A127540E9449BE002E46EA /* RegexKitLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegexKitLite.h; sourceTree = ""; }; 36 | 44A127550E9449BE002E46EA /* RegexKitLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RegexKitLite.m; sourceTree = ""; }; 37 | 44A127560E9449BE002E46EA /* RKLMatchEnumerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKLMatchEnumerator.h; sourceTree = ""; }; 38 | 44A127570E9449BE002E46EA /* RKLMatchEnumerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKLMatchEnumerator.m; sourceTree = ""; }; 39 | 44A127580E9449BE002E46EA /* IFTweetLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IFTweetLabel.m; sourceTree = ""; }; 40 | 44A127590E9449BE002E46EA /* IFTweetLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IFTweetLabel.h; sourceTree = ""; }; 41 | 44A127640E9449FA002E46EA /* libicucore.A.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.A.dylib; path = usr/lib/libicucore.A.dylib; sourceTree = SDKROOT; }; 42 | 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | /* End PBXFileReference section */ 44 | 45 | /* Begin PBXFrameworksBuildPhase section */ 46 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 47 | isa = PBXFrameworksBuildPhase; 48 | buildActionMask = 2147483647; 49 | files = ( 50 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 51 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 52 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 53 | 44A127650E9449FA002E46EA /* libicucore.A.dylib in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | 080E96DDFE201D6D7F000001 /* Classes */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 1D3623240D0F684500981E51 /* FancyLabelAppDelegate.h */, 64 | 1D3623250D0F684500981E51 /* FancyLabelAppDelegate.m */, 65 | 28D7ACF60DDB3853001CB0EB /* FancyLabelViewController.h */, 66 | 28D7ACF70DDB3853001CB0EB /* FancyLabelViewController.m */, 67 | 44A127530E9449BE002E46EA /* RegexKitLite */, 68 | 44A127580E9449BE002E46EA /* IFTweetLabel.m */, 69 | 44A127590E9449BE002E46EA /* IFTweetLabel.h */, 70 | ); 71 | path = Classes; 72 | sourceTree = ""; 73 | }; 74 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 1D6058910D05DD3D006BFB54 /* FancyLabel.app */, 78 | ); 79 | name = Products; 80 | sourceTree = ""; 81 | }; 82 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 080E96DDFE201D6D7F000001 /* Classes */, 86 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 87 | 29B97317FDCFA39411CA2CEA /* Resources */, 88 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 89 | 19C28FACFE9D520D11CA2CBB /* Products */, 90 | ); 91 | name = CustomTemplate; 92 | sourceTree = ""; 93 | }; 94 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 32CA4F630368D1EE00C91783 /* FancyLabel_Prefix.pch */, 98 | 29B97316FDCFA39411CA2CEA /* main.m */, 99 | ); 100 | name = "Other Sources"; 101 | sourceTree = ""; 102 | }; 103 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 107 | 8D1107310486CEB800E47090 /* Info.plist */, 108 | ); 109 | name = Resources; 110 | sourceTree = ""; 111 | }; 112 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 116 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 117 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 118 | 44A127640E9449FA002E46EA /* libicucore.A.dylib */, 119 | ); 120 | name = Frameworks; 121 | sourceTree = ""; 122 | }; 123 | 44A127530E9449BE002E46EA /* RegexKitLite */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | 44A127540E9449BE002E46EA /* RegexKitLite.h */, 127 | 44A127550E9449BE002E46EA /* RegexKitLite.m */, 128 | 44A127560E9449BE002E46EA /* RKLMatchEnumerator.h */, 129 | 44A127570E9449BE002E46EA /* RKLMatchEnumerator.m */, 130 | ); 131 | path = RegexKitLite; 132 | sourceTree = ""; 133 | }; 134 | /* End PBXGroup section */ 135 | 136 | /* Begin PBXNativeTarget section */ 137 | 1D6058900D05DD3D006BFB54 /* FancyLabel */ = { 138 | isa = PBXNativeTarget; 139 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "FancyLabel" */; 140 | buildPhases = ( 141 | 1D60588D0D05DD3D006BFB54 /* Resources */, 142 | 1D60588E0D05DD3D006BFB54 /* Sources */, 143 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 144 | ); 145 | buildRules = ( 146 | ); 147 | dependencies = ( 148 | ); 149 | name = FancyLabel; 150 | productName = FancyLabel; 151 | productReference = 1D6058910D05DD3D006BFB54 /* FancyLabel.app */; 152 | productType = "com.apple.product-type.application"; 153 | }; 154 | /* End PBXNativeTarget section */ 155 | 156 | /* Begin PBXProject section */ 157 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 158 | isa = PBXProject; 159 | attributes = { 160 | LastUpgradeCheck = 0420; 161 | }; 162 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "FancyLabel" */; 163 | compatibilityVersion = "Xcode 3.2"; 164 | developmentRegion = English; 165 | hasScannedForEncodings = 1; 166 | knownRegions = ( 167 | en, 168 | ); 169 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | 1D6058900D05DD3D006BFB54 /* FancyLabel */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | }; 187 | /* End PBXResourcesBuildPhase section */ 188 | 189 | /* Begin PBXSourcesBuildPhase section */ 190 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 191 | isa = PBXSourcesBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 195 | 1D3623260D0F684500981E51 /* FancyLabelAppDelegate.m in Sources */, 196 | 28D7ACF80DDB3853001CB0EB /* FancyLabelViewController.m in Sources */, 197 | 44A1275A0E9449BE002E46EA /* RegexKitLite.m in Sources */, 198 | 44A1275B0E9449BE002E46EA /* RKLMatchEnumerator.m in Sources */, 199 | 44A1275C0E9449BE002E46EA /* IFTweetLabel.m in Sources */, 200 | ); 201 | runOnlyForDeploymentPostprocessing = 0; 202 | }; 203 | /* End PBXSourcesBuildPhase section */ 204 | 205 | /* Begin XCBuildConfiguration section */ 206 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = NO; 210 | COPY_PHASE_STRIP = NO; 211 | GCC_DYNAMIC_NO_PIC = NO; 212 | GCC_OPTIMIZATION_LEVEL = 0; 213 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 214 | GCC_PREFIX_HEADER = FancyLabel_Prefix.pch; 215 | INFOPLIST_FILE = Info.plist; 216 | PRODUCT_NAME = FancyLabel; 217 | }; 218 | name = Debug; 219 | }; 220 | 1D6058950D05DD3E006BFB54 /* Release */ = { 221 | isa = XCBuildConfiguration; 222 | buildSettings = { 223 | ALWAYS_SEARCH_USER_PATHS = NO; 224 | COPY_PHASE_STRIP = YES; 225 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 226 | GCC_PREFIX_HEADER = FancyLabel_Prefix.pch; 227 | INFOPLIST_FILE = Info.plist; 228 | PRODUCT_NAME = FancyLabel; 229 | }; 230 | name = Release; 231 | }; 232 | C01FCF4F08A954540054247B /* Debug */ = { 233 | isa = XCBuildConfiguration; 234 | buildSettings = { 235 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 236 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 237 | GCC_C_LANGUAGE_STANDARD = c99; 238 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 239 | GCC_WARN_UNUSED_VARIABLE = YES; 240 | ONLY_ACTIVE_ARCH = YES; 241 | SDKROOT = iphoneos; 242 | }; 243 | name = Debug; 244 | }; 245 | C01FCF5008A954540054247B /* Release */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 249 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 250 | GCC_C_LANGUAGE_STANDARD = c99; 251 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 252 | GCC_WARN_UNUSED_VARIABLE = YES; 253 | SDKROOT = iphoneos; 254 | }; 255 | name = Release; 256 | }; 257 | /* End XCBuildConfiguration section */ 258 | 259 | /* Begin XCConfigurationList section */ 260 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "FancyLabel" */ = { 261 | isa = XCConfigurationList; 262 | buildConfigurations = ( 263 | 1D6058940D05DD3E006BFB54 /* Debug */, 264 | 1D6058950D05DD3E006BFB54 /* Release */, 265 | ); 266 | defaultConfigurationIsVisible = 0; 267 | defaultConfigurationName = Release; 268 | }; 269 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "FancyLabel" */ = { 270 | isa = XCConfigurationList; 271 | buildConfigurations = ( 272 | C01FCF4F08A954540054247B /* Debug */, 273 | C01FCF5008A954540054247B /* Release */, 274 | ); 275 | defaultConfigurationIsVisible = 0; 276 | defaultConfigurationName = Release; 277 | }; 278 | /* End XCConfigurationList section */ 279 | }; 280 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 281 | } 282 | -------------------------------------------------------------------------------- /FancyLabel.xcodeproj/project.xcworkspace/.gitignore: -------------------------------------------------------------------------------- 1 | xcuserdata 2 | -------------------------------------------------------------------------------- /FancyLabel.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FancyLabelViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 528 5 | 9E17 6 | 672 7 | 949.33 8 | 352.00 9 | 10 | YES 11 | 12 | 13 | 14 | YES 15 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 16 | 17 | 18 | YES 19 | 20 | IBFilesOwner 21 | 22 | 23 | IBFirstResponder 24 | 25 | 26 | 27 | 274 28 | {320, 460} 29 | 30 | 31 | 3 32 | MC43NQA 33 | 34 | 2 35 | 36 | 37 | NO 38 | 39 | 40 | 41 | 42 | 43 | YES 44 | 45 | 46 | view 47 | 48 | 49 | 50 | 7 51 | 52 | 53 | 54 | 55 | YES 56 | 57 | 0 58 | 59 | YES 60 | 61 | 62 | 63 | 64 | 65 | -1 66 | 67 | 68 | RmlsZSdzIE93bmVyA 69 | 70 | 71 | -2 72 | 73 | 74 | 75 | 76 | 6 77 | 78 | 79 | 80 | 81 | 82 | 83 | YES 84 | 85 | YES 86 | -1.CustomClassName 87 | -2.CustomClassName 88 | 6.IBEditorWindowLastContentRect 89 | 6.IBPluginDependency 90 | 91 | 92 | YES 93 | FancyLabelViewController 94 | UIResponder 95 | {{438, 347}, {320, 480}} 96 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 97 | 98 | 99 | 100 | YES 101 | 102 | YES 103 | 104 | 105 | YES 106 | 107 | 108 | 109 | 110 | YES 111 | 112 | YES 113 | 114 | 115 | YES 116 | 117 | 118 | 119 | 7 120 | 121 | 122 | 123 | YES 124 | 125 | FancyLabelViewController 126 | UIViewController 127 | 128 | IBProjectSource 129 | Classes/FancyLabelViewController.h 130 | 131 | 132 | 133 | 134 | 0 135 | FancyLabel.xcodeproj 136 | 3 137 | 138 | 139 | -------------------------------------------------------------------------------- /FancyLabel_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FancyLabel' target in the 'FancyLabel' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSMainNibFile 28 | MainWindow 29 | 30 | 31 | -------------------------------------------------------------------------------- /MainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 528 5 | 9F33 6 | 672 7 | 949.34 8 | 352.00 9 | 10 | YES 11 | 12 | 13 | YES 14 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 15 | 16 | 17 | YES 18 | 19 | IBFilesOwner 20 | 21 | 22 | IBFirstResponder 23 | 24 | 25 | 26 | 27 | 292 28 | {320, 480} 29 | 30 | 1 31 | MSAxIDEAA 32 | 33 | NO 34 | NO 35 | 36 | 37 | 38 | 39 | 40 | YES 41 | 42 | 43 | delegate 44 | 45 | 46 | 47 | 4 48 | 49 | 50 | 51 | window 52 | 53 | 54 | 55 | 14 56 | 57 | 58 | 59 | 60 | YES 61 | 62 | 0 63 | 64 | YES 65 | 66 | 67 | 68 | 69 | 70 | -1 71 | 72 | 73 | RmlsZSdzIE93bmVyA 74 | 75 | 76 | 3 77 | 78 | 79 | FancyLabel App Delegate 80 | 81 | 82 | -2 83 | 84 | 85 | 86 | 87 | 12 88 | 89 | 90 | 91 | 92 | 93 | 94 | YES 95 | 96 | YES 97 | -1.CustomClassName 98 | -2.CustomClassName 99 | 12.IBEditorWindowLastContentRect 100 | 12.IBPluginDependency 101 | 3.CustomClassName 102 | 3.IBPluginDependency 103 | 104 | 105 | YES 106 | UIApplication 107 | UIResponder 108 | {{525, 346}, {320, 480}} 109 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 110 | FancyLabelAppDelegate 111 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 | 113 | 114 | 115 | YES 116 | 117 | YES 118 | 119 | 120 | YES 121 | 122 | 123 | 124 | 125 | YES 126 | 127 | YES 128 | 129 | 130 | YES 131 | 132 | 133 | 134 | 14 135 | 136 | 137 | 138 | YES 139 | 140 | FancyLabelAppDelegate 141 | NSObject 142 | 143 | YES 144 | 145 | YES 146 | viewController 147 | window 148 | 149 | 150 | YES 151 | FancyLabelViewController 152 | UIWindow 153 | 154 | 155 | 156 | IBProjectSource 157 | Classes/FancyLabelAppDelegate.h 158 | 159 | 160 | 161 | FancyLabelAppDelegate 162 | NSObject 163 | 164 | IBUserSource 165 | 166 | 167 | 168 | 169 | FancyLabelViewController 170 | UIViewController 171 | 172 | IBProjectSource 173 | Classes/FancyLabelViewController.h 174 | 175 | 176 | 177 | 178 | 0 179 | FancyLabel.xcodeproj 180 | 3 181 | 182 | 183 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FancyLabel 4 | // 5 | // Created by Craig Hockenberry on 10/1/08. 6 | // Copyright The Iconfactory 2008. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) { 12 | 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | --------------------------------------------------------------------------------