1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //
- // FKBookTitleBtn.m
- // FirstLink
- //
- // Created by jack on 16/4/28.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKBookTitleBtn.h"
- @interface FKBookTitleBtn ()
- @property (nonatomic, strong) UIImageView *arrowImgView;
- @end
- @implementation FKBookTitleBtn
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
- [self addAllSubviews];
- }
- return self;
- }
- - (void)addAllSubviews{
-
- [self addSubview:self.arrowImgView];
- [self addSubview:self.titleLabel];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self).offset(- 10);
- make.centerY.equalTo(self);
- }];
-
- [self.arrowImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.titleLabel);
- make.left.equalTo(self.titleLabel.mas_right).offset(5);
- }];
- }
- - (void)setSelected:(BOOL)selected{
- [super setSelected:selected];
- if (selected){
- self.arrowImgView.transform = CGAffineTransformMakeRotation(M_PI);
- }else{
- self.arrowImgView.transform = CGAffineTransformIdentity;
- }
- }
- - (UIImageView *)arrowImgView{
- if (_arrowImgView == nil) {
- _arrowImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"book_red_arrow"]];
- }
- return _arrowImgView;
- }
- - (UILabel *)titleLabel{
- if (_titleLabel == nil) {
- _titleLabel = [[UILabel alloc]init];
- _titleLabel.textColor = UIColorFromRGB(0x4a4a4a);
- _titleLabel.font = [UIFont systemFontOfSize:18];
- _titleLabel.text = @"我的订阅";
- }
- return _titleLabel;
- }
- @end
|