Skip to content

Instantly share code, notes, and snippets.

View jverkoey's full-sized avatar

Jeff Verkoeyen jverkoey

View GitHub Profile
From 10d435690793854734c1e343491d3525ecb86745 Mon Sep 17 00:00:00 2001
From: Jeff Verkoeyen <jverkoey@gmail.com>
Date: Sat, 13 Feb 2010 18:14:08 -0500
Subject: [PATCH] Older SDKs (pre 3.2) seem to flip the shadow y offset, but 3.2 doesn't.
This fixes the TTStyle for shadows on 3.2.
---
src/TTStyle.m | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
@jverkoey
jverkoey / issue_151_test
Created November 6, 2010 02:33
Test case for 151.
diff --git a/samples/TTCatalog/Classes/TableControlsTestController.m b/samples/TTCatalog/Classes/TableControlsTestController.m
index 19b7380..08501fd 100644
--- a/samples/TTCatalog/Classes/TableControlsTestController.m
+++ b/samples/TTCatalog/Classes/TableControlsTestController.m
@@ -13,41 +13,45 @@
self.autoresizesForKeyboard = YES;
self.variableHeightRows = YES;
- UITextField* textField = [[[UITextField alloc] init] autorelease];
@jverkoey
jverkoey / gist:1374438
Created November 17, 2011 20:36
Modifying Nimbus NIToolbarPhotoViewController title.
- (void)updateTitle {
self.title = [NSString stringWithFormat:@"Custom formatting."];
}
- (void)photoAlbumScrollViewDidChangePages:(NIPhotoAlbumScrollView *)photoAlbumScrollView {
[super photoAlbumScrollViewDidChangePages:photoAlbumScrollView];
[self updateTitle];
}
@jverkoey
jverkoey / gist:1866500
Created February 19, 2012 23:35
Nimbus OAuth
typedef enum {
NIOpenAuthenticationStateFetchingToken,
NIOpenAuthenticationStateAuthorized,
} NIOpenAuthenticationState;
// Step 1: Create an auth object that will capture the token.
self.auth = [[[NISoundCloudOpenAuthenticator alloc]
initWithClientIdentifier:@"xxxxxx"
clientSecret:@"xxxxxx"] autorelease];
@jverkoey
jverkoey / NIAttributedLabelExample1.m
Created June 23, 2012 07:30
NIAttributedLabel Example 1
// We create an NIAttributedLabel the same way we would a UILabel.
NIAttributedLabel* label = [[NIAttributedLabel alloc] initWithFrame:CGRectZero];
// In practice we set the text before applying any CoreText style. Modifying the text after
// setting the styles will clear any existing CoreText-specific styles.
//
// Peeking under the hood: NIAttributedLabel creates an NSMutableAttributedString object when we
// set this text. The NSMutableAttributedString object is initially styled with whatever values
// were set on the UILabel. For example, if we set the textColor to blue and then set the text to
// @"Nimbus", the label would correctly display the text as blue. This allows you to treat
@jverkoey
jverkoey / NIAttributedLabelExample2.m
Created June 23, 2012 07:41
NIAttributedLabel Example 2
NSString* string =
@"For 20 years she has ventured into the dark horizon. "
@"At long last, a planet grows in the distance. "
@"\"Hello world!\" she exclaims.";
// We're going to customize the words "hello" and "world" in the string above to make them stand
// out in our text.
NSRange rangeOfHello = [string rangeOfString:@"Hello"];
NSRange rangeOfWorld = [string rangeOfString:@"world!"];
@jverkoey
jverkoey / NIAttributedLabelExample3.m
Created June 23, 2012 07:46
NIAttributedLabel Example 3
NIAttributedLabel* label = [[NIAttributedLabel alloc] initWithFrame:CGRectZero];
label.numberOfLines = 0;
label.lineBreakMode = UILineBreakModeWordWrap;
label.autoresizingMask = UIViewAutoresizingFlexibleDimensions;
label.frame = CGRectInset(self.view.bounds, 20, 20);
label.font = [UIFont fontWithName:@"AmericanTypewriter" size:15];
// In order to handle the events generated by the user tapping a link we must implement the
// delegate.
label.delegate = self;
@jverkoey
jverkoey / NIAttributedLabelExample4.m
Created June 23, 2012 07:50
NIAttributedLabel Example 4
NIAttributedLabel* label = [[NIAttributedLabel alloc] initWithFrame:CGRectZero];
label.numberOfLines = 0;
label.lineBreakMode = UILineBreakModeWordWrap;
label.autoresizingMask = UIViewAutoresizingFlexibleDimensions;
label.frame = CGRectInset(self.view.bounds, 20, 20);
label.font = [UIFont fontWithName:@"Optima-Regular" size:20];
label.delegate = self;
label.autoDetectLinks = YES;
// Turn on all available data detectors. This includes phone numbers, email addresses, and
@jverkoey
jverkoey / NIBadgeViewExample1.m
Created June 23, 2012 07:54
NIBadgeView Example 1
// We don't know what the initial frame will be, so pass the empty rect.
NIBadgeView* badgeView = [[NIBadgeView alloc] initWithFrame:CGRectZero];
// The badgeView backgroundColor is black by default.
badgeView.backgroundColor = self.view.backgroundColor;
// We can set any arbitrary text to the badge view.
badgeView.text = @"7";
// Once we've set the text we allow the badge view to size itself to fit the contents of the
@jverkoey
jverkoey / NILauncherModel1.m
Created June 23, 2012 08:03
NILauncherModel Example 1
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Load the Nimbus app icon.
NSString* imagePath = NIPathForBundleResource(nil, @"Icon.png");
UIImage* image = [[Nimbus imageMemoryCache] objectWithName:imagePath];
if (nil == image) {
image = [UIImage imageWithContentsOfFile:imagePath];
[[Nimbus imageMemoryCache] storeObject:image withName:imagePath];
}