No Description

SubmitInputCell.m 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // SubmitInputCellTableViewCell.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/6/18.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. // 文本输入的cell
  8. #import "SubmitInputCell.h"
  9. @implementation SubmitInputCell
  10. @synthesize titleLabel = _titleLabel;
  11. @synthesize inputField = _inputField;
  12. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  13. {
  14. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  15. if (self) {
  16. [self initialize];
  17. self.selectionStyle = UITableViewCellSelectionStyleNone;
  18. }
  19. return self;
  20. }
  21. - (void)initialize{
  22. [self.contentView addSubview:self.titleLabel];
  23. [self.contentView addSubview:self.inputField];
  24. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.equalTo(self.contentView).offset(15);
  26. make.centerY.equalTo(self.contentView);
  27. }];
  28. [self.inputField mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.equalTo(self.titleLabel.mas_right).offset(10);
  30. make.right.equalTo(self.contentView).offset(- 15);
  31. make.height.equalTo(self.contentView);
  32. make.centerY.equalTo(self.contentView);
  33. }];
  34. }
  35. - (void)fk_configWithViewModel:(FKSubmitOrderViewModel *)viewModel indexPath:(NSIndexPath *)indexPath{
  36. if ([viewModel isKindOfClass:[FKSubmitOrderViewModel class]]) {
  37. self.titleLabel.text = @"备注 :";
  38. self.inputField.placeholder = @"可以在这里补充说明哦";
  39. }
  40. }
  41. - (UITextField *)inputField{
  42. if (_inputField == nil) {
  43. _inputField = [[UITextField alloc]init];
  44. _inputField.textColor = UIColorFromRGB(0x333333);
  45. _inputField.font = [UIFont systemFontOfSize:14];
  46. _inputField.textAlignment = NSTextAlignmentLeft;
  47. _inputField.returnKeyType = UIReturnKeyDone;
  48. }
  49. return _inputField;
  50. }
  51. - (UILabel *)titleLabel{
  52. if (_titleLabel == nil) {
  53. _titleLabel = [[UILabel alloc]init];
  54. _titleLabel.backgroundColor = [UIColor clearColor];
  55. _titleLabel.font = [UIFont systemFontOfSize:14];
  56. _titleLabel.textColor = UIColorFromRGB(0x333333);
  57. [_titleLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  58. }
  59. return _titleLabel;
  60. }
  61. @end