[英]make sound loop Alerts every five seconds
我正在嘗試每五秒鍾編寫一個簡單的循環聲音警報
我該如何添加
調整cydia
Tweak.xm模板
if (lowenabled) {
if ([batString isEqualToString:lowbatPercent_String]) {
if (lowplayer) {
return;
}
if (lowsound == 0)
soundFilePath = [NSString stringWithFormat:@"%@/Super Mario.mp3", bundlePrefix];
else if (lowsound == 1)
soundFilePath = [NSString stringWithFormat:@"%@/Super Mario 1.mp3", bundlePrefix];
soundFileURL = [NSURL fileURLWithPath:soundFilePath];
lowplayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];
lowplayer.numberOfLoops = 3;
[lowplayer play];
} else {
if (lowplayer) {
lowplayer = nil;
}
}
}
}
%end
包括觸發計時器:
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(playSound:) userInfo:nil repeats:YES];
[timer fire];
將方法放在同一類中:
- (void)playSound {
// the code you included here that plays the sound
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.