forked from soffes/cheddar-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CDITagView.m
48 lines (40 loc) · 1.87 KB
/
CDITagView.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
//
// CDITagView.m
// Cheddar for iOS
//
// Created by Sam Soffes on 4/29/12.
// Copyright (c) 2012 Nothing Magical. All rights reserved.
//
#import "CDITagView.h"
#import "UIFont+CheddariOSAdditions.h"
@implementation CDITagView
@synthesize textLabel = _textLabel;
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.colors = [[NSArray alloc] initWithObjects:
[UIColor colorWithRed:0.0f green:0.722f blue:0.918f alpha:1.0f],
[UIColor colorWithRed:0.0f green:0.631f blue:0.835f alpha:1.0f],
nil];
self.topBorderColor = [UIColor colorWithRed:0.392f green:0.808f blue:0.945f alpha:1.0f];
self.bottomInsetColor = [UIColor colorWithRed:0.306f green:0.745f blue:0.886f alpha:1.0f];
self.bottomBorderColor = [UIColor colorWithRed:0.0f green:0.502f blue:0.725f alpha:1.0f];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10.0f, 13.0f, 24.0f, 24.0f)];
imageView.image = [UIImage imageNamed:@"tag.png"];
[self addSubview:imageView];
_textLabel = [[UILabel alloc] initWithFrame:CGRectMake(44.0f, 13.0f, self.bounds.size.width - 54.0f, 24.0f)];
_textLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
_textLabel.backgroundColor = [UIColor clearColor];
_textLabel.textColor = [UIColor whiteColor];
_textLabel.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.2f];
_textLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
_textLabel.font = [UIFont cheddarFontOfSize:24.0f];
[self addSubview:_textLabel];
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.bounds.size.width - 26.0f, 18.0f, 16.0f, 16.0f)];
imageView.image = [UIImage imageNamed:@"tag-x.png"];
imageView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
[self addSubview:imageView];
}
return self;
}
@end