From 25f409185a53e5e7beb17518a684298d92d31b3f Mon Sep 17 00:00:00 2001 From: 单军华 <WindShan@danjunhuas-MacBook-Pro.local> Date: Fri, 04 May 2018 13:34:53 +0800 Subject: [PATCH] iPhone x 屏幕适配修改 --- pregnancy_guard/BaseProject/Views/Cell/MusicPlayCell.m | 66 +++++++++++++++++++++++++-------- 1 files changed, 50 insertions(+), 16 deletions(-) diff --git a/pregnancy_guard/BaseProject/Views/Cell/MusicPlayCell.m b/pregnancy_guard/BaseProject/Views/Cell/MusicPlayCell.m index c3f4375..b467b51 100644 --- a/pregnancy_guard/BaseProject/Views/Cell/MusicPlayCell.m +++ b/pregnancy_guard/BaseProject/Views/Cell/MusicPlayCell.m @@ -8,15 +8,15 @@ #import "MusicPlayCell.h" #import "GloriaLabel.h" -#import "UpdateHotelAccountPage.h" @interface MusicPlayCell() { - + } @property (nonatomic, strong) GloriaLabel * NumberLabel; @property (nonatomic, strong) GloriaLabel * musicNameLabel; +@property (nonatomic, strong) GloriaLabel * LevelsNameLabel; @property (nonatomic, strong) UIButton * personalLikeBtn; @property (nonatomic, strong) UIButton * userPlayBtn; @end @@ -24,20 +24,22 @@ @implementation MusicPlayCell /* -// Only override drawRect: if you perform custom drawing. -// An empty implementation adversely affects performance during animation. -- (void)drawRect:(CGRect)rect { - // Drawing code -} -*/ + // 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.musicNameLabel.frame = CGRectMake(20+40, 25, SCREEN_WIDTH/2, 20); + self.LevelsNameLabel.frame = CGRectMake(20+40, 5, SCREEN_WIDTH/2, 20); + self.personalLikeBtn.frame = CGRectMake(SCREEN_WIDTH-20-15, 17, 15, 15); self.userPlayBtn.frame = CGRectMake(SCREEN_WIDTH-20-15-50-15, 17, 15, 15); } @@ -60,7 +62,8 @@ { if ( _delegate && [_delegate respondsToSelector:@selector(musicPlaySection:)]) { - self.model.cmd = 2; + self.model.playStatus = (self.model.playStatus == 1 ? 2:1); + self.model.cmd = 1; [_delegate musicPlaySection:self.model]; } } @@ -83,9 +86,24 @@ { if ( _delegate && [_delegate respondsToSelector:@selector(musicPlaySection:)]) { - self.model.cmd = 1; + self.model.setStatus = (self.model.setStatus == 1 ? 2:1); + self.model.cmd = 2; [_delegate musicPlaySection:self.model]; } +} + +- (GloriaLabel *) LevelsNameLabel +{ + if(!_LevelsNameLabel) + { + _LevelsNameLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)]; + _LevelsNameLabel.font = [UIFont systemFontOfSize:16]; + _LevelsNameLabel.textAlignment = UITextAlignmentLeft; + _LevelsNameLabel.textColor = kUIColorFromRGB(0x595959); + [self.contentView addSubview:_LevelsNameLabel]; + } + + return _LevelsNameLabel; } - (GloriaLabel *) NumberLabel @@ -109,18 +127,34 @@ _musicNameLabel = [[GloriaLabel alloc] initWithFrame:CGRectMake(10+50+10+80, 28,150, 14)]; _musicNameLabel.font = [UIFont systemFontOfSize:16]; _musicNameLabel.textAlignment = UITextAlignmentLeft; - _musicNameLabel.textColor = kUIColorFromRGB(0x595959); + _musicNameLabel.textColor = kUIColorFromRGB(0xc4c4c4); [self.contentView addSubview:_musicNameLabel]; } return _musicNameLabel; } -- (void)setItemView:(HotelAccount*)model +- (void)setItemView:(MusicModel*)model { self.model = model; - [self.NumberLabel setText:model.hotel_id.name]; - [self.musicNameLabel setText:model.username]; + //icon_musicset + [self.userPlayBtn setBackgroundImage:[UIImage imageNamed: model.playStatus == 1 ?@"icon_play":@"icon_start" ] forState:UIControlStateNormal]; + [self.personalLikeBtn setBackgroundImage:[UIImage imageNamed: @"icon_voiceset"] forState:UIControlStateNormal]; + [self.NumberLabel setText:model.xuhaoIndex]; + [self.musicNameLabel setText:model.musicName]; + [self.LevelsNameLabel setText:model.username]; + } +- (void)setItemView:(MusicModel *) model setName:(NSString*)name +{ + self.model = model; + //icon_musicset + [self.userPlayBtn setBackgroundImage:[UIImage imageNamed: model.playStatus == 1 ?@"icon_play":@"icon_start" ] forState:UIControlStateNormal]; + [self.personalLikeBtn setBackgroundImage:[UIImage imageNamed: name] forState:UIControlStateNormal]; + [self.NumberLabel setText:model.xuhaoIndex]; + [self.musicNameLabel setText:model.musicName]; + [self.LevelsNameLabel setText:model.username]; +} @end + -- Gitblit v1.8.0