Skip to content

Commit

Permalink
removed objective-c tag, unfortunately not supported by appledoc
Browse files Browse the repository at this point in the history
  • Loading branch information
odrobnik committed Dec 18, 2013
1 parent 65aa610 commit 0dcc575
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Documentation/Programming Guide-template.markdown
Expand Up @@ -9,7 +9,7 @@ Smoke Test
After having integrated DTCoreText and its dependencies into your project you should be able to build your app be able to use DTCoreText functionality. As a quick *Smoke Test* - to see if all is setup correctly - you can test your setup by adding this code to your app delegate: After having integrated DTCoreText and its dependencies into your project you should be able to build your app be able to use DTCoreText functionality. As a quick *Smoke Test* - to see if all is setup correctly - you can test your setup by adding this code to your app delegate:




``` objective-c ```
#import "DTCoreText.h" #import "DTCoreText.h"
NSString *html = @"<p>Some Text</p>"; NSString *html = @"<p>Some Text</p>";
Expand All @@ -32,7 +32,7 @@ For most normal use cases you can use the overrides plist that is part of the DT


If you don't know the set of fonts used by your app you can trigger an asynchronous pre-loading of the internal lookup table. To start the loading process you add the following to your app delegate. If you don't know the set of fonts used by your app you can trigger an asynchronous pre-loading of the internal lookup table. To start the loading process you add the following to your app delegate.


``` objective-c ```
// preload font matching table // preload font matching table
[DTCoreTextFontDescriptor asyncPreloadFontLookupTable]; [DTCoreTextFontDescriptor asyncPreloadFontLookupTable];
``` ```
Expand All @@ -44,7 +44,7 @@ Setting a Fallback Font Family


When encountering a font family in HTML that is not known to the system the fallback font family is used. This can be set like this: When encountering a font family in HTML that is not known to the system the fallback font family is used. This can be set like this:


``` objective-c ```
[DTCoreTextFontDescriptor setFallbackFontFamily:@"Helvetica Neue"]; [DTCoreTextFontDescriptor setFallbackFontFamily:@"Helvetica Neue"];
``` ```


Expand All @@ -55,7 +55,7 @@ Getting a Tapped Word


To retrieve the word a user tapped on you get the closest cursor position to the tapped point. Then you iterate over the plain text's words until you find the one that contains the cursor position's string index. To retrieve the word a user tapped on you get the closest cursor position to the tapped point. Then you iterate over the plain text's words until you find the one that contains the cursor position's string index.


``` objective-c ```
- (void)handleTap:(UITapGestureRecognizer *)gesture - (void)handleTap:(UITapGestureRecognizer *)gesture
{ {
if (gesture.state == UIGestureRecognizerStateRecognized) if (gesture.state == UIGestureRecognizerStateRecognized)
Expand Down Expand Up @@ -85,7 +85,7 @@ Visible String Range


To retrieve the string range in the `NSAttributedString` you set on an DTAttributedTextView you have to get the scroll view bounds. Then you retrieve an array of lines visible in this rectangle from the DTCoreTextLayoutFrame. Finally you retrieve and create a union of the string ranges. To retrieve the string range in the `NSAttributedString` you set on an DTAttributedTextView you have to get the scroll view bounds. Then you retrieve an array of lines visible in this rectangle from the DTCoreTextLayoutFrame. Finally you retrieve and create a union of the string ranges.


``` objective-c ```
CGRect visibleRect = _textView.bounds; CGRect visibleRect = _textView.bounds;
NSArray *visibleLines = [_textView.attributedTextContentView.layoutFrame linesVisibleInRect:visibleRect]; NSArray *visibleLines = [_textView.attributedTextContentView.layoutFrame linesVisibleInRect:visibleRect];
Expand All @@ -100,7 +100,7 @@ Determing Size Required for an Attributed String


When creating a DTCoreTextLayoutFrame you can specify the maximum width and height that should be filled with text. If you specify `CGFLOAT_WIDTH_UNKNOWN` for the frame size width then the needed with will be calculated. If you specify `CGFLOAT_HEIGHT_UNKNOWN` the height will be calculated. You can get the needed size from the layoutFrame's frame property. When creating a DTCoreTextLayoutFrame you can specify the maximum width and height that should be filled with text. If you specify `CGFLOAT_WIDTH_UNKNOWN` for the frame size width then the needed with will be calculated. If you specify `CGFLOAT_HEIGHT_UNKNOWN` the height will be calculated. You can get the needed size from the layoutFrame's frame property.


``` objective-c ```
NSAttributedString *attributedString = ... NSAttributedString *attributedString = ...
DTCoreTextLayouter *layouter = [[DTCoreTextLayouter alloc] initWithAttributedString:attributedString]; DTCoreTextLayouter *layouter = [[DTCoreTextLayouter alloc] initWithAttributedString:attributedString];
Expand All @@ -118,7 +118,7 @@ Displaying remote images
The best way to display remote images is to use `DTLazyImageView`. The best way to display remote images is to use `DTLazyImageView`.
First you will need to return `DTLazyImageView` instance for your image attachments. First you will need to return `DTLazyImageView` instance for your image attachments.


``` objective-c ```
- (UIView *)attributedTextContentView:(DTAttributedTextContentView *)attributedTextContentView viewForAttachment:(DTTextAttachment *)attachment frame:(CGRect)frame - (UIView *)attributedTextContentView:(DTAttributedTextContentView *)attributedTextContentView viewForAttachment:(DTTextAttachment *)attachment frame:(CGRect)frame
{ {
if([attachment isKindOfClass:[DTImageTextAttachment class]]) if([attachment isKindOfClass:[DTImageTextAttachment class]])
Expand All @@ -136,7 +136,7 @@ First you will need to return `DTLazyImageView` instance for your image attachme


Then in the in delegate method for `DTLazyImageView` reset the layout for the affected `DTAttributedContextView`. Then in the in delegate method for `DTLazyImageView` reset the layout for the affected `DTAttributedContextView`.


``` objective-c ```
- (void)lazyImageView:(DTLazyImageView *)lazyImageView didChangeImageSize:(CGSize)size - (void)lazyImageView:(DTLazyImageView *)lazyImageView didChangeImageSize:(CGSize)size
{ {
NSURL *url = lazyImageView.url; NSURL *url = lazyImageView.url;
Expand Down

0 comments on commit 0dcc575

Please sign in to comment.