|
@@ -233,23 +233,25 @@
|
|
// }];
|
|
// }];
|
|
[testText appendAttributedString: attrString];
|
|
[testText appendAttributedString: attrString];
|
|
|
|
|
|
- //读题
|
|
|
|
- QMUIButton *readBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
- CGFloat ebtnH = 20.f;
|
|
|
|
- CGFloat ebtnW = 58.f;
|
|
|
|
- CGSize ebtnSize = CGSizeMake(ebtnW, ebtnH);
|
|
|
|
- readBtn.size = btnSize;
|
|
|
|
- [readBtn setImage:RQImageNamed(@"读题pay") forState:UIControlStateNormal];
|
|
|
|
- [readBtn setImage:RQImageNamed(@"读题pause") forState:UIControlStateSelected];
|
|
|
|
- [readBtn addTarget:self action:@selector(buttonActionPayVoicedo:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
- NSMutableAttributedString *readAttachment = [NSMutableAttributedString yy_attachmentStringWithContent:readBtn
|
|
|
|
- contentMode:UIViewContentModeCenter
|
|
|
|
- attachmentSize:ebtnSize
|
|
|
|
- alignToFont:[UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize]
|
|
|
|
- alignment:YYTextVerticalAlignmentCenter];
|
|
|
|
- self.readBtn = readBtn;
|
|
|
|
- [testText appendAttributedString:self.spaceAttachment];
|
|
|
|
- [testText appendAttributedString:readAttachment];
|
|
|
|
|
|
+ if (RQ_COMMON_MANAGER.JSJP_APP_VOICE) {//读题-是否开启
|
|
|
|
+ //读题
|
|
|
|
+ QMUIButton *readBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
+ CGFloat ebtnH = 20.f;
|
|
|
|
+ CGFloat ebtnW = 58.f;
|
|
|
|
+ CGSize ebtnSize = CGSizeMake(ebtnW, ebtnH);
|
|
|
|
+ readBtn.size = btnSize;
|
|
|
|
+ [readBtn setImage:RQImageNamed(@"读题pay") forState:UIControlStateNormal];
|
|
|
|
+ [readBtn setImage:RQImageNamed(@"读题pause") forState:UIControlStateSelected];
|
|
|
|
+ [readBtn addTarget:self action:@selector(buttonActionPayVoicedo:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
+ NSMutableAttributedString *readAttachment = [NSMutableAttributedString yy_attachmentStringWithContent:readBtn
|
|
|
|
+ contentMode:UIViewContentModeCenter
|
|
|
|
+ attachmentSize:ebtnSize
|
|
|
|
+ alignToFont:[UIFont systemFontOfSize:RQ_Exercise_Module.exerciseFontSize]
|
|
|
|
+ alignment:YYTextVerticalAlignmentCenter];
|
|
|
|
+ self.readBtn = readBtn;
|
|
|
|
+ [testText appendAttributedString:self.spaceAttachment];
|
|
|
|
+ [testText appendAttributedString:readAttachment];
|
|
|
|
+ }
|
|
|
|
|
|
[text appendAttributedString:testText];
|
|
[text appendAttributedString:testText];
|
|
// [text appendAttributedString:[self padding]];
|
|
// [text appendAttributedString:[self padding]];
|
|
@@ -306,6 +308,7 @@
|
|
#pragma mark -事件
|
|
#pragma mark -事件
|
|
- (void)buttonActionPayVoicedo:(UIButton *)btn
|
|
- (void)buttonActionPayVoicedo:(UIButton *)btn
|
|
{
|
|
{
|
|
|
|
+ btn.userInteractionEnabled = NO;
|
|
btn.selected = !btn.isSelected;
|
|
btn.selected = !btn.isSelected;
|
|
if(btn.selected){//播放
|
|
if(btn.selected){//播放
|
|
if (NY_VOICE_MANAGER.state == NYVoiceType_Pause){
|
|
if (NY_VOICE_MANAGER.state == NYVoiceType_Pause){
|
|
@@ -338,6 +341,10 @@
|
|
}else {//暂停
|
|
}else {//暂停
|
|
[NY_VOICE_MANAGER pausePayVoiceAction];
|
|
[NY_VOICE_MANAGER pausePayVoiceAction];
|
|
}
|
|
}
|
|
|
|
+ //防止频繁点击 1 秒点一次
|
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
+ self.readBtn.userInteractionEnabled = YES;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
@end
|
|
@end
|