-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBCClassButton.m
57 lines (46 loc) · 1.42 KB
/
BCClassButton.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
53
54
55
56
57
//
// BCClassButton.m
// MUSTBEE
//
// Created by zbc on 15/10/19.
// Copyright © 2015年 zbc. All rights reserved.
//
#import "BCClassButton.h"
@implementation BCClassButton
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
- (instancetype)init
{
self = [super init];
if (self) {
}
return self;
}
-(id) initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
return self;
}
- (void) DrawButton:(NSString *)className ClassTime:(NSString *)ClassTime{
UILabel *ClassNameLabel;
UILabel *PlaceLabel;
ClassNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, self.frame.size.width-10,40)];
[ClassNameLabel setNumberOfLines:2];
ClassNameLabel.textAlignment = UITextAlignmentCenter;
UIFont *font = [UIFont fontWithName:@"Arial" size:10];
ClassNameLabel.font = font;
ClassNameLabel.text = className;
ClassNameLabel.textColor = [UIColor whiteColor];
[self addSubview:ClassNameLabel];
PlaceLabel = [[UILabel alloc] initWithFrame:CGRectMake(5,self.frame.size.height - 40, self.frame.size.width-10,40)];
PlaceLabel.font = font;
PlaceLabel.text = ClassTime;
PlaceLabel.textAlignment = UITextAlignmentCenter;
PlaceLabel.textColor = [UIColor whiteColor];
[self addSubview:PlaceLabel];
}
@end