Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <UIKit/UIKit.h>
- @interface CustomTextView : UITextView <NSLayoutManagerDelegate>
- @end
- #import "CustomTextView.h"
- @implementation CustomTextView
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self)
- {
- self.backgroundColor = [UIColor clearColor];
- self.font = [UIFont systemFontOfSize:21.0];
- self.dataDetectorTypes = UIDataDetectorTypeAll;
- self.layoutManager.delegate = self;
- self.tintColor = [UIColor companyBlue];
- [self setLinkTextAttributes:@{NSForegroundColorAttributeName:[UIColor companyBlue]}];
- self.contentInset = UIEdgeInsetsMake(0.5, 0, 0, 0);
- self.scrollEnabled = NO;
- self.textContainer.maximumNumberOfLines = 9;
- self.textContainer.lineBreakMode = NSLineBreakByCharWrapping;
- }
- return self;
- }
- - (CGFloat)layoutManager:(NSLayoutManager *)layoutManager lineSpacingAfterGlyphAtIndex:(NSUInteger)glyphIndex withProposedLineFragmentRect:(CGRect)rect
- {
- return 4.9;
- }
- @end
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self)
- {
- self.backgroundColor = [UIColor clearColor];
- self.font = [UIFont systemFontOfSize:21.0];
- self.dataDetectorTypes = UIDataDetectorTypeAll;
- self.layoutManager.delegate = self;
- self.tintColor = [UIColor companyBlue];
- [self setLinkTextAttributes:@{NSForegroundColorAttributeName:[UIColor companyBlue]}];
- self.scrollEnabled = NO;
- self.textContainerInset = UIEdgeInsetsMake(8.5, 0, 0, 0);
- self.textContainer.maximumNumberOfLines = 9;
- self.textContainer.lineBreakMode = NSLineBreakByTruncatingTail;
- }
- return self;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement