mirror of
https://github.com/danog/Telegram.git
synced 2024-12-03 09:57:46 +01:00
48 lines
1022 B
Objective-C
48 lines
1022 B
Objective-C
#import "TGTextViewCollectionItemView.h"
|
|
|
|
#import "TGFont.h"
|
|
|
|
@interface TGTextViewCollectionItemView () <UITextViewDelegate>
|
|
{
|
|
UITextView *_textView;
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation TGTextViewCollectionItemView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
{
|
|
self = [super initWithFrame:frame];
|
|
if (self != nil)
|
|
{
|
|
_textView = [[UITextView alloc] init];
|
|
_textView.backgroundColor = [UIColor clearColor];
|
|
_textView.textColor = [UIColor blackColor];
|
|
_textView.font = TGSystemFontOfSize(16.0f);
|
|
_textView.delegate = self;
|
|
[self.contentView addSubview:_textView];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)layoutSubviews
|
|
{
|
|
[super layoutSubviews];
|
|
|
|
_textView.frame = CGRectMake(4.0f, 0.0f, self.contentView.bounds.size.width - 8.0f, self.contentView.bounds.size.height);
|
|
}
|
|
|
|
- (void)setText:(NSString *)text
|
|
{
|
|
_textView.text = text;
|
|
}
|
|
|
|
- (void)textViewDidChange:(UITextView *)__unused textView
|
|
{
|
|
if (_textChanged)
|
|
_textChanged(_textView.text);
|
|
}
|
|
|
|
@end
|