//
|
// MusicPlayCell.m
|
// istanbul
|
//
|
// Created by WindShan on 2017/6/16.
|
// Copyright © 2017年 WindShan. All rights reserved.
|
//
|
|
#import "MusicPlayCell.h"
|
#import "GloriaLabel.h"
|
#import "UpdateHotelAccountPage.h"
|
|
@interface MusicPlayCell()
|
{
|
|
}
|
|
@property (nonatomic, strong) GloriaLabel * NumberLabel;
|
@property (nonatomic, strong) GloriaLabel * musicNameLabel;
|
@property (nonatomic, strong) UIButton * personalLikeBtn;
|
@property (nonatomic, strong) UIButton * userPlayBtn;
|
@end
|
|
@implementation MusicPlayCell
|
|
/*
|
// Only override drawRect: if you perform custom drawing.
|
// An empty implementation adversely affects performance during animation.
|
- (void)drawRect:(CGRect)rect {
|
// Drawing code
|
}
|
*/
|
|
- (void)layoutSubviews
|
{
|
[super layoutSubviews];
|
|
self.NumberLabel.frame = CGRectMake(20, 10, 40, 30);
|
self.musicNameLabel.frame = CGRectMake(20, 40, SCREEN_WIDTH/2, 30);
|
|
self.personalLikeBtn.frame = CGRectMake(SCREEN_WIDTH-20-15, 17, 15, 15);
|
self.userPlayBtn.frame = CGRectMake(SCREEN_WIDTH-20-15-50-15, 17, 15, 15);
|
}
|
|
-(UIButton*)userPlayBtn
|
{
|
if(!_userPlayBtn)
|
{
|
_userPlayBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
_userPlayBtn.frame = CGRectMake(0, SCREEN_HEIGHT-100, 118, 30);
|
[_userPlayBtn setBackgroundImage:[UIImage imageNamed:@"icon_start" ] forState:UIControlStateNormal];
|
[_userPlayBtn addTarget:self action:@selector(playAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.contentView addSubview:_userPlayBtn];
|
}
|
|
return _userPlayBtn;
|
}
|
|
-(void)playAction
|
{
|
if ( _delegate && [_delegate respondsToSelector:@selector(musicPlaySection:)])
|
{
|
self.model.cmd = 2;
|
[_delegate musicPlaySection:self.model];
|
}
|
}
|
|
-(UIButton*)personalLikeBtn
|
{
|
if(!_personalLikeBtn)
|
{
|
_personalLikeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
_personalLikeBtn.frame = CGRectMake(0, SCREEN_HEIGHT-100, 118, 30);
|
[_personalLikeBtn setBackgroundImage:[UIImage imageNamed:@"icon_unlike" ] forState:UIControlStateNormal];
|
[_personalLikeBtn addTarget:self action:@selector(personalLikeAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.contentView addSubview:_personalLikeBtn];
|
}
|
|
return _personalLikeBtn;
|
}
|
|
-(void)personalLikeAction
|
{
|
if ( _delegate && [_delegate respondsToSelector:@selector(musicPlaySection:)])
|
{
|
self.model.cmd = 1;
|
[_delegate musicPlaySection:self.model];
|
}
|
}
|
|
- (GloriaLabel *) NumberLabel
|
{
|
if(!_NumberLabel)
|
{
|
_NumberLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)];
|
_NumberLabel.font = [UIFont systemFontOfSize:16];
|
_NumberLabel.textAlignment = UITextAlignmentLeft;
|
_NumberLabel.textColor = kUIColorFromRGB(0xc4c4c4);
|
[self.contentView addSubview:_NumberLabel];
|
}
|
|
return _NumberLabel;
|
}
|
|
- (GloriaLabel *) musicNameLabel
|
{
|
if(!_musicNameLabel)
|
{
|
_musicNameLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)];
|
_musicNameLabel.font = [UIFont systemFontOfSize:16];
|
_musicNameLabel.textAlignment = UITextAlignmentLeft;
|
_musicNameLabel.textColor = kUIColorFromRGB(0x595959);
|
[self.contentView addSubview:_musicNameLabel];
|
}
|
|
return _musicNameLabel;
|
}
|
|
- (void)setItemView:(HotelAccount*)model
|
{
|
self.model = model;
|
[self.NumberLabel setText:model.hotel_id.name];
|
[self.musicNameLabel setText:model.username];
|
}
|
|
@end
|