Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removed test code

  • Loading branch information...
commit 75502c96e522721f771341eff860b7a158769d09 1 parent 991b639
@Cocoanetics authored
Showing with 0 additions and 20 deletions.
  1. +0 −20 Demo/Source/CoreTextDemoAppDelegate.m
View
20 Demo/Source/CoreTextDemoAppDelegate.m
@@ -15,26 +15,6 @@ @implementation CoreTextDemoAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
- // Setup font and paragraph style
- DTCoreTextFontDescriptor* titleFontDescriptor = [[DTCoreTextFontDescriptor alloc] initWithFontAttributes:nil];
- titleFontDescriptor.pointSize = 20.0f;
- titleFontDescriptor.fontFamily = @"PT Serif";
- titleFontDescriptor.boldTrait = YES;
- CTFontRef titleFont = [titleFontDescriptor newMatchingFont];
- NSString* titleString = [[NSString alloc] initWithFormat:@"%@\n", @"Google Wallet’s Founding Engineer, Product Lead Already at Work on Next Startup, Tappmo"]; // A long string that triggers line switching.
- DTCoreTextParagraphStyle* titleParagraphStyle = [DTCoreTextParagraphStyle defaultParagraphStyle];
- titleParagraphStyle.paragraphSpacing = 14;
- titleParagraphStyle.maximumLineHeight = 10; //Whatever you chose, nothing happens.
- titleParagraphStyle.lineHeightMultiple = 0.5; //Whatever you chose, nothing happens.
- NSAttributedString* titleNSAString = [[NSAttributedString alloc] initWithString:titleString attributes:[NSDictionary dictionaryWithObjectsAndKeys:(__bridge id)(titleFont), (id)kCTFontAttributeName, CFBridgingRelease([titleParagraphStyle createCTParagraphStyle]), (id)kCTParagraphStyleAttributeName, nil]];
-
- // Calculate the height
- DTCoreTextLayouter* titleLayouter = [[DTCoreTextLayouter alloc] initWithAttributedString:titleNSAString];
- DTCoreTextLayoutFrame* dtFrame = [titleLayouter layoutFrameWithRect:CGRectMake(0, 0, 300, CGFLOAT_OPEN_HEIGHT) range:NSMakeRange(0, titleNSAString.length)];
- dtFrame.lines; // To manually trigger line building(Maybe a better way to this?)
- float resultHeight = dtFrame.frame.size.height; // Never affected by lineHeightMultiple/maximumLineHeight.
-
-
// Create window
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
Please sign in to comment.
Something went wrong with that request. Please try again.