-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathMRPRAcceptEditCell.m
76 lines (65 loc) · 2.64 KB
/
MRPRAcceptEditCell.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// MRPRAcceptEditCell.m
// Coding_iOS
//
// Created by Ease on 15/6/1.
// Copyright (c) 2015年 Coding. All rights reserved.
//
#define kMRPRAcceptEditCell_TextViewHeight (kScreen_Height/4)
#import "MRPRAcceptEditCell.h"
@interface MRPRAcceptEditCell ()<UITextViewDelegate>
//@property (strong, nonatomic) UIView *lineView;
@end
@implementation MRPRAcceptEditCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = kColorTableBG;
UILabel *titleL = [UILabel new];
titleL.font = [UIFont systemFontOfSize:15];
titleL.textColor = kColorDark7;
titleL.text = @"Merge Commit Message";
[self.contentView addSubview:titleL];
UIView *lineView = [UIView new];
lineView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"dot_line"]];
[self.contentView addSubview:lineView];
_contentTextView = [UIPlaceHolderTextView new];
_contentTextView.backgroundColor = [UIColor clearColor];
_contentTextView.font = [UIFont systemFontOfSize:15];
_contentTextView.textColor = kColorDark3;
_contentTextView.delegate = self;
_contentTextView.placeholder = @"输入点什么...";
[self.contentView addSubview:_contentTextView];
[titleL mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView).offset(kPaddingLeftWidth);
make.right.equalTo(self.contentView).offset(-kPaddingLeftWidth);
make.top.equalTo(self.contentView).offset(15);
make.height.mas_equalTo(20);
}];
[lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(titleL.mas_bottom).offset(15);
make.left.right.equalTo(titleL);
make.height.mas_equalTo(0.5);
}];
[_contentTextView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(lineView).offset(7);
make.left.equalTo(titleL).offset(-8);
make.right.equalTo(titleL).offset(8);
make.height.mas_equalTo(kMRPRAcceptEditCell_TextViewHeight);
}];
}
return self;
}
+ (CGFloat)cellHeight{
return 15+ 20+ 15+ kMRPRAcceptEditCell_TextViewHeight + 15;
}
#pragma mark TextView Delegate
- (void)textViewDidChange:(UITextView *)textView{
if (self.contentChangedBlock) {
self.contentChangedBlock(textView.text);
}
}
@end