Iphone을 처음 사용하고 webView에서 비디오를 재생하려고합니다. 그래서, 그 완료 버튼 작업을해야합니다. Pls 날 도와.WebView에서로드 할 때 Movie Player에서 버튼 동작을 완료하는 방법은 무엇입니까?
2
A
답변
0
비디오가있는 UIWebView에서 재생하면 동영상이 재생되고 완료되면 버튼을 사용하여 웹보기에 URL을로드하는 데 사용했던 코드와 함께 다음과 같은 코드를 사용하여 눌렀을 때 다음에 액세스 할 수 있습니다
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayStarted:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayFinished:) name:@"UIMoviePlayerControllerDidExitFullscreenNotification" object:nil];
그리고 이 마지막 난 완료 버튼 동작에 대한 해결책을 발견
BOOL isVideoInFullScreenMode;//Temperory added here.. must be in .h file or at teh top if required
-(void)videoPlayStarted:(NSNotification *)notification{
//Your stuff here
isVideoInFullScreenMode = YES;
}
-(void)videoPlayFinished:(NSNotification *)notification{
//Your stuffs here
isVideoInFullScreenMode = NO;
}
0
통해 액세스 할 수 ...이 논리 & 아이폰도 모두 아이 패드 작동 .. 난 UIGestureRecognizer를 사용하여 확률값을 해결했다.
여기 내 코드입니다.
우선 내가 ..
-(void)youTubeStarted:(NSNotification *)notification{
if (!tapRecognizer1) {
tapRecognizer1 = [[UITapGestureRecognizer alloc] init];
tapRecognizer1.delegate = self;
[tapRecognizer1 setNumberOfTapsRequired:1];
[self.view addGestureRecognizer:tapRecognizer1];
}
}
이것은 movieplayer에 TapRecognizer를 추가합니다 ..이 코드를 추가 youTubeStarted 방법 지금
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(youTubeStarted:) name:@"UIMoviePlayerControllerDidEnterFullscreenNotification" object:nil];
를 사용하여 EnterFullScreen에 대한 알림을 추가하고
그리고 이제 다음 대리자 메서드는 버튼이 완료되었는지 확인합니다.
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
NSLog(@"%@",touch.description);
NSString *ViewName = touch.description ;
CGPoint location = [touch locationInView:touch.view];
NSLog(@"location x===%f , location y=== %f",location.x,location.y);
NSRange Check = [ViewName rangeOfString:@"UINavigationButton"];
NSRange checkFrameOfButton;
if (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) {
checkFrameOfButton = [ViewName rangeOfString:@"frame = (7 7; 50 30)"];
if (checkFrameOfButton.length <= 0) {
checkFrameOfButton = [ViewName rangeOfString:@"frame = (7 7; 51 30)"];
}
}
else {
checkFrameOfButton = [ViewName rangeOfString:@"frame = (5 7; 48 30)"];
if (Check.length<=0) {
Check = [ViewName rangeOfString:@"UIView"];
}
}
if (location.y<40 && location.x<85 && Check.length>0 && checkFrameOfButton.length>0) {
[self endplaying];
}
return YES;
}
이제는 endplaying 방법으로 원하는 것을 할 수 있습니다.
관련 문제
- 1. webview에서로드 할 페이지의 HTML 코드를 가져 오는 방법은 무엇입니까?
- 2. 키보드 완료 버튼 동작을 변경하는 방법은 무엇입니까?
- 3. 라디오 버튼 동작을 구현하는 방법은 무엇입니까?
- 4. ASP.NET의 버튼 동작을 제출하십시오.
- 5. Windows에서 psql을 완료하는 방법은 무엇입니까?
- 6. VMWare Player에서 키보드 구성을 극복하는 방법은 무엇입니까?
- 7. parse.com을 Flash Player에서 사용하는 방법은 무엇입니까?
- 8. Windows Media Player에서 수행 한 동작을 캡처하는 방법
- 9. 표면 뷰 내부에서 작업을 완료하는 방법은 무엇입니까?
- 10. paramiko가 전송 대기를 완료하는 방법은 무엇입니까?
- 11. 컨트롤러의 버튼 동작을 다른 뷰로 만드는 방법은 무엇입니까?
- 12. 버튼 동작을 통해 설정 얻기
- 13. 인터 럽션없이 애니메이션을 완료하는 방법은 무엇입니까?
- 14. 배치 파일 코드를 완료하는 방법은 무엇입니까?
- 15. 레일스 작성 작업을 완료하는 올바른 방법은 무엇입니까?
- 16. 추상 수업을 완료하는 일반적인 방법은 무엇입니까?
- 17. 버튼 동작과 단절 동작을 분리하십시오
- 18. "movie"명령에서 GIF 애니메이션 만들기
- 19. QuickTime Movie View를 사용할 때 크래시가 발생했습니다.
- 20. 버튼/텍스트를 클릭 할 때 정보를 공개하는 방법은 무엇입니까?
- 21. WebView에서로드 된 리소스의 백분율을 가져옵니다.
- 22. 프로그래밍 방식으로 uibarbuttonitem의 동작을 실행하는 방법은 무엇입니까?
- 23. '새'컨트롤러 동작을 테스트하는 방법은 무엇입니까?
- 24. UITabBarViewController의 동작을 시뮬레이트하는 방법은 무엇입니까?
- 25. OpenCV 함수 사용 movie()
- 26. Flash Player에서 스트리밍 할 수있는 파일 유형은 무엇입니까?
- 27. 양식에 대한 동작을 정의 할 때
- 28. jQuery - '바꾸기'기능이 동작을 수행 할 때 감지합니다.
- 29. 레일스가 동작을 표시 할 때 편집을 실행합니다
- 30. 기본 동작을 지연하는 방법은 무엇입니까?