| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //
- // TabControl.m
- // model
- //
- // Created by Drew on 2018/11/1.
- // Copyright © 2018年 Mine. All rights reserved.
- //
- #import "TabControl.h"
- @interface TabControl()
- @property (weak, nonatomic) IBOutlet UIView *indicator;
- @end
- @implementation TabControl
- - (instancetype)initWithFrame:(CGRect)frame {
- if (self = [super initWithFrame:frame]) {
- [self initView];
- }
- return self;
- }
- - (instancetype)initWithCoder:(NSCoder *)aDecoder {
- if (self = [super initWithCoder:aDecoder]) {
- [self initView];
- }
- return self;
- }
- - (void) initView {
- NSBundle *bundle = [NSBundle bundleForClass:[self class]];
- NSString *className = NSStringFromClass([self class]);
- UIView *view = [[bundle loadNibNamed:className owner:self options:nil] firstObject];
- view.frame = self.bounds;
- view.backgroundColor = [UIColor clearColor];
- [self addSubview:view];
- self.clipsToBounds = YES;
- }
- -(void)layoutSubviews {
- self.layer.cornerRadius = self.frame.size.height / 2;
- self.indicator.layer.cornerRadius = self.frame.size.height / 2;
- }
- @end
|