NIMContactSelectTabView.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // NIMContactSelectTabView.m
  3. // NIMKit
  4. //
  5. // Created by chris on 15/9/15.
  6. // Copyright (c) 2015年 NetEase. All rights reserved.
  7. //
  8. #import "NIMContactSelectTabView.h"
  9. #import "NIMContactPickedView.h"
  10. #import "UIView+NIM.h"
  11. #import "UIImage+NIMKit.h"
  12. @implementation NIMContactSelectTabView
  13. - (instancetype)initWithFrame:(CGRect)frame{
  14. self = [super initWithFrame:frame];
  15. if (self) {
  16. _pickedView = [[NIMContactPickedView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  17. [self addSubview:_pickedView];
  18. _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
  19. UIImage *doneButtonNormal = [UIImage nim_imageInKit:@"icon_cell_blue_normal"];
  20. UIImage *doneButtonHighlighted = [UIImage nim_imageInKit:@"icon_cell_blue_normal"];
  21. [_doneButton setBackgroundImage:doneButtonNormal forState:UIControlStateNormal];
  22. [_doneButton setBackgroundImage:doneButtonHighlighted forState:UIControlStateHighlighted];
  23. [_doneButton setTitle:@"确定" forState:UIControlStateNormal];
  24. _doneButton.nim_size = doneButtonNormal.size;
  25. [self addSubview:_doneButton];
  26. self.backgroundColor = [UIColor colorWithPatternImage:[UIImage nim_imageInKit:@"contact_bg.png"]];
  27. }
  28. return self;
  29. }
  30. - (void)layoutSubviews{
  31. [super layoutSubviews];
  32. CGFloat spacing = 15.f;
  33. _pickedView.nim_height = self.nim_height;
  34. _pickedView.nim_width = self.nim_width - _doneButton.nim_width - spacing;
  35. CGFloat doneButtonRight = 15.f;
  36. _doneButton.nim_right = self.nim_width - doneButtonRight;
  37. _doneButton.nim_centerY = self.nim_height * .5f;
  38. }
  39. @end