0
A
답변
0
터치가 UITouch의 유형을 사용하는 손가락 스타일러스에서 나온 것인지 확인할 수 있습니다.
if (touch.type == UITouchTypeStylus) {
//its touch from Stylus.
}
지금있는 ScrollView를 들어, 당신은있는 UIScrollView의 서브 클래스를 생성하고 TouchBegan 방법을 구현할 수
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
if (touch.type == UITouchTypeStylus) {
self.scrollEnabled = NO;
}
else
{
self.scrollEnabled = YES;
}
[super touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
if (touch.type == UITouchTypeStylus) {
self.scrollEnabled = NO;
}
else
{
self.scrollEnabled = YES;
}
[super touchesMoved:touches withEvent:event];
}
// 편집 또는
서브 클래스 UIApplication :
@interface MyUIApplication : UIApplication
- (void)sendEvent:(UIEvent *)event {
[super sendEvent:event];
NSSet *allTouches = [event allTouches];
if ([allTouches count] > 0) {
/
UITouchPhase phase = ((UITouch *)[allTouches anyObject]).phase;
if (phase == UITouchPhaseBegan){
UITouch *touch = [allTouches anyObject];
if (touch.type == UITouchTypeStylus) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"DisableScroll" object:self];
}
else
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"EnableScroll" object:self];
}
}
}
}
@end
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, NSStringFromClass([MyUIApplication class]), NSStringFromClass([AppDelegate class]));
}
}
하는 관찰자 추가 스크롤 뷰 a를 포함한 클래스의 이러한 통지 그에 따라 스크롤을 활성화/비활성화합니다.
1
UIGestureRecognizer에서 allowedTouchTypes
속성을 설정할 수 있습니다. 예를 들어
는 :
scrollView.panGestureRecognizer.allowedTouchTypes = [UITouchType.direct.rawValue as NSNumber]
관련 문제
- 1. 스크롤 사용 안 함
- 2. iframe에서 스크롤 사용 안 함
- 3. 스크롤 사용 안 함 UIWebView
- 4. Osmdroid에서 스크롤 사용 안 함
- 5. 가로 스크롤 사용 안 함
- 6. 스크롤 사용 안 함 UIPageViewController
- 7. Scrollview에서 스크롤 사용 안 함
- 8. SlickGrid에서 스크롤 사용 안 함
- 9. gridview 스크롤 사용 안 함
- 10. POST에서 스크롤 사용 안 함
- 11. ListView 스크롤 사용 안 함
- 12. NipagingScrollView에서 스크롤 사용 안 함
- 13. Div에서 스크롤 사용 안 함
- 14. System.Console.Write로 스크롤 사용 안 함
- 15. Konzept에서 스크롤 사용 안 함
- 16. iframe에서 스크롤 사용 안 함
- 17. 후크 스크롤 사용 안 함
- 18. iPad에서 선택 옵션 필드 사용 안 함
- 19. 스크롤 이벤트에서 오디오 사용/사용 안 함
- 20. RichTextBox에서 스크롤 사용 안 함 (C#)
- 21. jQuery 탭 jQuery 스크롤 사용 안 함
- 22. NSScrollView에서 WKWebView의 스크롤 사용 안 함
- 23. NSScrollView 자동 스크롤 사용 안 함
- 24. 이미지 확대/축소시 스크롤 사용 안 함
- 25. IE에서 패닝/스크롤 사용 안 함
- 26. ListView에서 아래로 스크롤 사용 안 함 - Android
- 27. Dojox Mobile Scrollable보기 - 스크롤 사용 안 함
- 28. GWT 가로 끌기 스크롤 사용 안 함
- 29. 목록보기에서 가로 스크롤 막대 사용 안 함
- 30. 터치 스크린 스크롤 사용 안 함
나는 이미 시도했지만 touchesBegan 스크롤 후 트리거되는 몇 가지 이유 때문에 scrollEnabled 내가 만지지 다음 시간에 적용되고 시작됩니다. (스타일러스로 스크롤 할 때 처음으로 스크롤 할 때) – MoHaKa
이 함수'scrollViewWillBeginDragging' (UIScrollView 델리게이트에 존재 함)은 다른 어떤 것보다 먼저 ('touchesBegan'이전에) 트리거가 시작됩니다. 이 시점에서 터치의 유형을 얻을 수있는 방법이 있다면 나는 그것이 작동한다고 생각합니다. – MoHaKa
이 경우 UIApplication을 서브 클래스화할 수 있으며 sendEvent 메소드를 사용할 수 있습니다. 대답에 더 자세히 설명하겠습니다. – Darshana