Files
2026-07-13 12:35:01 +08:00

58 lines
1.2 KiB
Objective-C

//
// TLSettingItemSwitchCell.m
// TLChat
//
// Created by 李伯坤 on 2018/3/7.
// Copyright © 2018年 李伯坤. All rights reserved.
//
#import "TLSettingItemSwitchCell.h"
@interface TLSettingItemSwitchCell ()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UISwitch *switchControl;
@end
@implementation TLSettingItemSwitchCell
- (id)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self p_initSettingItemSwitchCellSubviews];
}
return self;
}
- (void)setItem:(TLSettingItem *)item
{
item.showDisclosureIndicator = NO;
item.disableHighlight = YES;
[super setItem:item];
[self.titleLabel setText:item.title];
}
#pragma mark - # UI
- (void)p_initSettingItemSwitchCellSubviews
{
self.titleLabel = self.contentView.addLabel(1)
.masonry(^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(0);
make.left.mas_equalTo(15);
make.right.mas_lessThanOrEqualTo(-80);
})
.view;
self.switchControl = self.contentView.addSwitch(2)
.masonry(^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(0);
make.right.mas_lessThanOrEqualTo(-15);
})
.view;
}
@end