TXWechatInfoView.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // WechatInfoView.m
  3. // TXXiaoShiPinDemo
  4. //
  5. // Created by shengcui on 2018/9/14.
  6. // Copyright © 2018年 tencent. All rights reserved.
  7. //
  8. #import "TXWechatInfoView.h"
  9. #define L(X) NSLocalizedString((X), nil)
  10. @implementation TXWechatInfoView
  11. {
  12. UILabel *wechatInfoLabel;
  13. }
  14. - (instancetype)initWithFrame:(CGRect)frame
  15. {
  16. self = [super initWithFrame:frame];
  17. if (self) {
  18. self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
  19. wechatInfoLabel = [[UILabel alloc] initWithFrame:self.bounds];
  20. wechatInfoLabel.numberOfLines = 0;
  21. wechatInfoLabel.textColor = [UIColor colorWithWhite:1 alpha:1];
  22. wechatInfoLabel.text = [@[L(@"如何获取技术支持服务?"), L(@"关注公众号“腾讯云视频”"), L(@"给公众号发送“小视频”")] componentsJoinedByString:@"\n"];
  23. wechatInfoLabel.textAlignment = NSTextAlignmentCenter;
  24. [wechatInfoLabel sizeToFit];
  25. [self addSubview:wechatInfoLabel];
  26. }
  27. return self;
  28. }
  29. - (CGSize)sizeThatFits:(CGSize)size
  30. {
  31. return [wechatInfoLabel sizeThatFits:size];
  32. }
  33. - (void)layoutSubviews {
  34. [super layoutSubviews];
  35. wechatInfoLabel.frame = self.bounds;
  36. }
  37. @end