MineItemView.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // MineItemView.m
  3. // 千模
  4. //
  5. // Created by Drew on 2018/10/24.
  6. // Copyright © 2018年 MUMEI. All rights reserved.
  7. //
  8. #import "MineItemView.h"
  9. @interface MineItemView ()
  10. @property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
  11. @property (weak, nonatomic) IBOutlet UILabel *menuLabel;
  12. @end
  13. @implementation MineItemView
  14. - (instancetype)initWithFrame:(CGRect)frame{
  15. if(self = [super initWithFrame:frame]){
  16. NSBundle *bundle = [NSBundle bundleForClass:[self class]];
  17. NSString *className = NSStringFromClass([self class]);
  18. UIView *view = [[bundle loadNibNamed:className owner:self options:nil] firstObject];
  19. view.frame = self.bounds;
  20. [self addSubview:view];
  21. }
  22. return self;
  23. }
  24. - (instancetype)initWithCoder:(NSCoder *)aDecoder{
  25. if(self = [super initWithCoder:aDecoder]){
  26. NSBundle *bundle = [NSBundle bundleForClass:[self class]];
  27. NSString *className = NSStringFromClass([self class]);
  28. UIView *view = [[bundle loadNibNamed:className owner:self options:nil] firstObject];
  29. view.frame = self.bounds;
  30. [self addSubview:view];
  31. }
  32. return self;
  33. }
  34. -(void)setIcon:(NSString *)icon{
  35. self.iconImageView.image = [UIImage imageNamed:icon];
  36. }
  37. -(void)setLabel:(NSString *)label{
  38. self.menuLabel.text = label;
  39. }
  40. -(void)setImage:(UIImage *)image{
  41. self.iconImageView.image = image;
  42. }
  43. @end