YMGuildManagementPagingViewTableHeaderView.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // YMGuildManagementPagingViewTableHeaderView.m
  3. // JXCategoryView
  4. //
  5. // Created by jiaxin on 2018/8/27.
  6. // Copyright © 2018年 jiaxin. All rights reserved.
  7. //
  8. #import "YMGuildManagementPagingViewTableHeaderView.h"
  9. @interface YMGuildManagementPagingViewTableHeaderView()
  10. @property (nonatomic, strong) UIImageView *imageView;
  11. @property (nonatomic, assign) CGRect imageViewFrame;
  12. //@property (nonatomic, strong) UILabel *nickLabel;
  13. @end
  14. @implementation YMGuildManagementPagingViewTableHeaderView
  15. - (instancetype)initWithFrame:(CGRect)frame
  16. {
  17. self = [super initWithFrame:frame];
  18. if (self) {
  19. _imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"gonghui_nav_bg"]];
  20. self.imageView.clipsToBounds = YES;
  21. self.imageView.frame = CGRectMake(0, 0, frame.size.width, frame.size.height);
  22. self.imageView.contentMode = UIViewContentModeScaleAspectFill;
  23. [self addSubview:self.imageView];
  24. self.imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  25. // _nickLabel = [[UILabel alloc] init];
  26. // self.nickLabel.font = [UIFont systemFontOfSize:20];
  27. // self.nickLabel.text = @"Monkey·D·路飞";
  28. // self.nickLabel.textColor = [UIColor redColor];
  29. // [self addSubview:self.nickLabel];
  30. }
  31. return self;
  32. }
  33. - (void)layoutSubviews {
  34. [super layoutSubviews];
  35. self.imageViewFrame = self.bounds;
  36. //self.nickLabel.frame = CGRectMake(10, self.bounds.size.height - 30, 200, 20);
  37. }
  38. - (void)scrollViewDidScroll:(CGFloat)contentOffsetY {
  39. CGRect frame = self.imageViewFrame;
  40. frame.size.height -= contentOffsetY;
  41. frame.origin.y = contentOffsetY;
  42. self.imageView.frame = frame;
  43. }
  44. @end