나는 미친 듯이 주변을 둘러 보았습니다. 나는 볼륨 버튼 길고 짧은 언론 (예 : snapchat, 짧은 보도 사진, 긴 언론 기록 비디오)과 같은 사용자 지정 작업을 수행해야하지만 실패했습니다.길고 짧은 볼륨 버튼 감지 - iOS
나는 볼륨 버튼 누름 이벤트를 감지 할 수 있도록 https://github.com/jpsim/JPSVolumeButtonHandler 을 사용했습니다. 그러나 아주 열심히 노력한 후에 나는 그 긴 언론과 짧은 언론을 발견하지 못했습니다.
도//Volume button handler
self.volumeButtonHandler = [JPSVolumeButtonHandler volumeButtonHandlerWithUpBlock:^{
// Volume Up Button Pressed
[self onVolumeUp];
} downBlock:^{
// Volume Down Button Pressed
}];
-(void)onVolumeUp {
if(self.volButtonTimer) {
secondsElapsed = 1; //To detect long press
[self.volButtonTimer invalidate];
}
self.volButtonTimer = [NSTimer scheduledTimerWithTimeInterval:0.5
target:self
selector:@selector(onTimerFire)
userInfo:nil
repeats:NO];
}
-(void)onTimerFire {
NSLog(@"Long Press %d",secondsElapsed);
if (secondsElapsed > 1)
{
//Do Something
}
else secondsElapsed = 0;
}
나는이에 대한 도움이 필요하세요 내 코드 Detect iPhone Volume Button Hold? (iOS 8)
를 참조하십시오. Google 전체에서 검색했지만 실패했습니다. snapchat이 그것을하고 있다면, 그것의 행할 수 있음을 의미합니다.
고맙습니다.
아를, 그 Snapchat에서 - 규칙 차단기! –
솔루션을 찾았습니다. 편집 된 답변을 참조하십시오. – Timo
예, 우리는 또한 같은 기능을 구현하지만, dispatch_after() 메서드. Snapchat을 App과 같이 만들기 때문에 내 개인 징징이 나옵니다. Appstore에서 Snapchat 금지를위한 음성 수집이 필요합니다. –