-
Notifications
You must be signed in to change notification settings - Fork 0
/
DemoTextField.m
executable file
·52 lines (40 loc) · 1.37 KB
/
DemoTextField.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
44
45
46
47
48
49
50
51
52
//
// DemoTextField.m
// MHTextField
//
// Created by Mehfuz Hossain on 12/3/13.
// Copyright (c) 2013 Mehfuz Hossain. All rights reserved.
//
#import "DemoTextField.h"
@implementation DemoTextField
- (void)awakeFromNib
{
[super awakeFromNib];
[self setBorderStyle:UITextBorderStyleNone];
[self setFont: [UIFont systemFontOfSize:17]];
[self setTintColor:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0]];
[self setBackgroundColor:[UIColor whiteColor]];
}
- (CGRect)textRectForBounds:(CGRect)bounds
{
return CGRectInset(bounds, 10, 5);
}
- (CGRect)editingRectForBounds:(CGRect)bounds
{
return CGRectInset(bounds, 10, 5);
}
- (void)layoutSublayersOfLayer:(CALayer *)layer
{
[super layoutSublayersOfLayer:layer];
[layer setBorderWidth: 0.8];
[layer setBorderColor: [UIColor colorWithWhite:0.1 alpha:0.2].CGColor];
[layer setCornerRadius:3.0];
[layer setShadowOpacity:1.0];
[layer setShadowColor:[UIColor redColor].CGColor];
[layer setShadowOffset:CGSizeMake(1.0, 1.0)];
}
- (void) drawPlaceholderInRect:(CGRect)rect {
NSDictionary *attributes = @{ NSFontAttributeName: [UIFont systemFontOfSize:17], NSForegroundColorAttributeName : [UIColor colorWithRed:182/255. green:182/255. blue:183/255. alpha:1.0]};
[self.placeholder drawInRect:CGRectInset(rect, 5, 5) withAttributes:attributes];
}
@end