1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // HomeActionView.m
- // KulexiuForTeacher
- //
- // Created by 王智 on 2022/7/7.
- //
- #import "HomeActionView.h"
- @interface HomeActionView ()
- @property (weak, nonatomic) IBOutlet UILabel *actionNameLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *actionImage;
- @property (weak, nonatomic) IBOutlet UIButton *actionButton;
- @property (nonatomic, copy) HomeActionCallback callback;
- @end
- @implementation HomeActionView
- + (instancetype)shareInstance {
- HomeActionView *view = [[[NSBundle mainBundle] loadNibNamed:@"HomeActionView" owner:nil options:nil] firstObject];
- return view;
- }
- - (void)configWithName:(NSString *)actionName firstDesc:(NSString *)firstDesc imageName:(NSString *)actionImage index:(NSInteger)actionIndex callback:(HomeActionCallback)callback {
- if (callback) {
- self.callback = callback;
- }
- self.actionNameLabel.text = actionName;
- self.firstDescLabel.text = firstDesc;
- self.actionButton.tag = actionIndex;
- [self.actionImage setImage:[UIImage imageNamed:actionImage]];
- }
- - (IBAction)buttonAction:(UIButton *)sender {
- if (self.callback) {
- self.callback(sender.tag);
- }
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- @end
|