/
PSNonEdiableTextView.m
43 lines (34 loc) · 1.24 KB
/
PSNonEdiableTextView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// PSNonEdiableTextView.m
// PSFoundation
//
// Created by Peter Steinberger on 19.11.10.
// Copyright 2010 Peter Steinberger. All rights reserved.
//
#import "PSNonEdiableTextView.h"
#include "UIView+Sizes.h"
#import <QuartzCore/QuartzCore.h>
#define RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
@implementation PSNonEdiableTextView
+ (id)textViewForText:(NSString *)text {
PSNonEdiableTextView *textView = [[[[self class] alloc] init] autorelease];
textView.textColor = RGBCOLOR(76,86,108);
textView.layer.shadowColor = [[UIColor whiteColor] CGColor];
textView.layer.shadowOffset = CGSizeMake(1, 1);
[textView.layer setShadowOpacity:1.0];
[textView.layer setShadowRadius:0.3];
textView.backgroundColor = [UIColor clearColor];
textView.scrollEnabled = NO;
textView.scrollsToTop = NO;
textView.editable = NO;
textView.textAlignment = UITextAlignmentCenter;
textView.text = text;
textView.font = [UIFont systemFontOfSize:14];
CGSize size1 = [textView.text sizeWithFont:textView.font constrainedToSize:CGSizeMake(300.0f, 9999.0f) lineBreakMode:UILineBreakModeWordWrap];
textView.height = size1.height + 10;
return textView;
}
- (BOOL)canBecomeFirstResponder {
return NO;
}
@end