WFCUMultiCallOngoingExpendedCell.m 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // WFCUMultiCallOngoingExpendedCell.m
  3. // WFChatUIKit
  4. //
  5. // Created by Rain on 2022/5/8.
  6. // Copyright © 2022 Wildfirechat. All rights reserved.
  7. //
  8. #import "WFCUMultiCallOngoingExpendedCell.h"
  9. @implementation WFCUMultiCallOngoingExpendedCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  15. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  16. if(self) {
  17. [self.contentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  18. [obj removeFromSuperview];
  19. }];
  20. self.backgroundColor = [UIColor colorWithRed:0.5 green:0.9 blue:0.5 alpha:0.5];
  21. [self joinButton];
  22. [self cancelButton];
  23. }
  24. return self;
  25. }
  26. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  27. [super setSelected:selected animated:animated];
  28. // Configure the view for the selected state
  29. }
  30. -(UILabel *)callHintLabel {
  31. if(!_callHintLabel) {
  32. _callHintLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 4, [UIScreen mainScreen].bounds.size.width-16, 20)];
  33. [self.contentView addSubview:_callHintLabel];
  34. }
  35. return _callHintLabel;
  36. }
  37. -(UIButton *)joinButton {
  38. if(!_joinButton) {
  39. CGRect screenBounds = [UIScreen mainScreen].bounds;
  40. _joinButton = [[UIButton alloc] initWithFrame:CGRectMake(screenBounds.size.width/2 - 60 - 40, 28, 60, 24)];
  41. [_joinButton setTitle:WFCString(@"Join") forState:UIControlStateNormal];
  42. [_joinButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  43. [_joinButton addTarget:self action:@selector(onJoinButton) forControlEvents:UIControlEventTouchUpInside];
  44. [self.contentView addSubview:_joinButton];
  45. }
  46. return _joinButton;
  47. }
  48. -(UIButton *)cancelButton {
  49. if(!_cancelButton) {
  50. CGRect screenBounds = [UIScreen mainScreen].bounds;
  51. _cancelButton = [[UIButton alloc] initWithFrame:CGRectMake(screenBounds.size.width/2 + 40, 28, 60, 24)];
  52. [_cancelButton setTitle:WFCString(@"Cancel") forState:UIControlStateNormal];
  53. [_cancelButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  54. [_cancelButton addTarget:self action:@selector(onCancelButton) forControlEvents:UIControlEventTouchUpInside];
  55. [self.contentView addSubview:_cancelButton];
  56. }
  57. return _cancelButton;
  58. }
  59. - (void)onJoinButton {
  60. if([self.delegate respondsToSelector:@selector(didJoinButtonPressed)]) {
  61. [self.delegate didJoinButtonPressed];
  62. }
  63. }
  64. - (void)onCancelButton {
  65. if([self.delegate respondsToSelector:@selector(didCancelButtonPressed)]) {
  66. [self.delegate didCancelButtonPressed];
  67. }
  68. }
  69. @end