-
Notifications
You must be signed in to change notification settings - Fork 9
/
PlainSectionHeader.m
48 lines (36 loc) · 1.09 KB
/
PlainSectionHeader.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
//
// PlainSectionHeader.m
// MyKeePass
//
// Created by Qiang Yu on 3/7/10.
// Copyright 2010 Qiang Yu. All rights reserved.
//
#import "PlainSectionHeader.h"
@implementation PlainSectionHeader
@synthesize _label;
- (id)initWithTitle:(NSString *) title {
if (self = [super initWithFrame:CGRectMake(0, 0, 320, 20)]) {
self.backgroundColor = [UIColor clearColor];
_label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 300, 20)];
_label.backgroundColor = [UIColor clearColor];
_label.font = [UIFont boldSystemFontOfSize:16];
_label.text = title;
[self addSubview:_label];
_button = [UIButton buttonWithType:UIButtonTypeCustom];
_button.frame = CGRectMake(300, 0, 20, 20);
[_button setImage:[UIImage imageNamed:@"plus.png"] forState:UIControlStateNormal];
[self addSubview:_button];
}
return self;
}
- (void)drawRect:(CGRect)rect {
// Drawing code
}
- (void)dealloc {
[super dealloc];
}
-(id)setAddButtonTarget:(id)target selector:(SEL)selector{
[_button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
return self;
}
@end