123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //
- // SettingBodyView.m
- // KulexiuForTeacher
- //
- // Created by Kyle on 2022/3/22.
- //
- #import "SettingBodyView.h"
- @interface SettingBodyView ()
- @property (nonatomic, copy) SettingCallback callback;
- @property (weak, nonatomic) IBOutlet UIButton *switchButton;
- @property (weak, nonatomic) IBOutlet UIView *checkView;
- @end
- @implementation SettingBodyView
- + (instancetype)shareInstance {
- SettingBodyView *view = [[[NSBundle mainBundle] loadNibNamed:@"SettingBodyView" owner:nil options:nil] firstObject];
- return view;
- }
- - (void)settingAction:(SettingCallback)callback {
- if (callback) {
- self.callback = callback;
- }
- }
- - (IBAction)tapAction:(UITapGestureRecognizer *)sender {
- NSInteger index = sender.view.tag;
- if (self.callback) {
- self.callback(index);
- }
- }
- - (IBAction)enableCheckAction:(id)sender {
- self.enableCheck = !self.enableCheck;
- if (self.callback) {
- self.callback(SETTINGACTION_ONLINECHECK);
- }
- }
- - (void)setEnableCheck:(BOOL)enableCheck {
- _enableCheck = enableCheck;
- NSString *imageName = enableCheck ? @"switch_on" : @"switch_off";
- [self.switchButton setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
- }
- - (IBAction)logoutAction:(id)sender {
- if (self.callback) {
- self.callback(SETTINGACTION_LOGOUT);
- }
- }
- - (void)setIsMember:(BOOL)isMember {
- _isMember = isMember;
- if (isMember) {
- self.checkView.hidden = YES;
- }
- else {
- self.checkView.hidden = NO;
- }
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- @end
|