사실 저는 스크롤 뷰가 있습니다. 30 버튼을 사용하고 있습니다. 내 요구 사항은 버튼을 재정렬해야한다는 것입니다. 마찬가지로, 어떤 버튼을 만졌을 때 그것은 우리의 터치로 선택되어야합니다. 우리가 스크롤 - 뷰에서 움직이는 곳은 우리의 터치와 함께 움직여야합니다. 내가 터치를 마친 후에는 버튼을 교체해야합니다. 어느 누구도 이것에 관해 나를 도와 줄 수 있습니까? .........우리는 touchesBegan, touchesMoved, scrollview에 대해 touchesEnded를 사용할 수 없습니까?
0
A
답변
0
당신은이 일을 할 수 있지만 많은 일들이 있습니다. 다음이 필요합니다.
1. 단추가 될 UIControl 서브 클래스를 작성하십시오.
2. 모든 터치 * 메소드를 무시합니다.
3. 표준 uicontrol 동작 + 동작 동작을 구현하십시오.
#pragma mark -
#pragma mark Touches delegate methods
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
[self performSelector:@selector(delayedTouchBeging:) withObject:touch afterDelay:0.15];
[super touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if (dragging) {
// move your view in new position here
} else {
[super touchesMoved:touches withEvent:event];
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (dragging) {
// Do other stuff if you need
} else {
[super touchesEnded:touches withEvent:event];
}
dragging = NO;
[NSObject cancelPreviousPerformRequestsWithTarget:self];
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesEnded:touches withEvent:event];
}
- (void) delayedTouchBeging:(UITouch*) touch {
dragging = YES;
[self cancelTrackingWithEvent:nil];
// Do here stuff about begin moving (animation, etc)
}
0
"Launcher"코드는 무료로 제공되는 three20 코드 카탈로그의 일부로 사용하는 방법을 살펴볼 수 있습니다. 그들은 정확히 이와 같은 작업을 수행합니다 (iPhone 앱보기에서 주변을 이동하거나 삭제할 수있는 곳을 모방합니다).
관련 문제
- 1. 프로그래밍 방식으로 TouchesBegan, TouchesMoved, TouchedEnded를 호출하는 방법
- 2. Cocos2D TouchesEnded를 사용하면 스프라이트에 액세스 할 수 없습니까?
- 3. iPhone "touchesBegan"및 "touchesMoved"메시지 ... 터치 센터로 이동하지 마십시오
- 4. iPhone 멀티 터치 - 일부 터치 파견 touchesBegan : touchesMoved :
- 5. touchesMoved : withEvent
- 6. UITableViewCell에서 "touchesBegan"을 사용할 수 있습니까?
- 7. touchesMoved
- 8. touchesMoved QuartzDemo 응용 프로그램
- 9. WriteableBitmap을 사용할 수 없습니까?
- 10. iphone touchesbegan
- 11. 교환식이지만 부울은 사용할 수 없습니까?
- 12. touchesBegan & touchsMoved
- 13. 건 드리면 touchesmoved 사용할 때 Touchesbegan은 항상 발사됩니까?
- 14. 동일한 DateTime 값에 대해 서로 다른 EditorTemplates를 사용할 수 없습니까?
- 15. 바이너리 데이터에 대해 Urlllib2.urlopen을 사용할 수 없습니까?
- 16. repaint()를 사용할 수 없습니까?
- 17. 크리스탈 보고서를 사용할 수 없습니까?
- 18. GWT에서 IntegerColumn을 사용할 수 없습니까?
- 19. 모노크롬에서는 MKCoordinateRegionForMapRect를 사용할 수 없습니까?
- 20. Linux에서 stat.h를 사용할 수 없습니까?
- 21. CodeIgniter - 모델이로드되었지만 사용할 수 없습니까?
- 22. Silverlight에서 XDocument를 사용할 수 없습니까?
- 23. touchesBegan 후에 터치 이벤트를 강제로 취소 할 수 있습니까?
- 24. touchesBegan afterRotateFromInterfaceOrientation
- 25. touchesBegan, touchesMoved 및 touchesEnded 메서드가 UIViewController 대 UIView 내에서 처리되는 시간이 있습니까?
- 26. 우리는 wcf에서 system.web.mail을 사용할 수 있습니까?
- 27. touchesmoved leave frame
- 28. 페이징없이 UITcrollView with touchesmoved
- 29. 메모리에 대해 걱정할 시간이 없습니까?
- 30. 제네릭 형식에 대해 == 연산자를 만들 수 없습니까?
어떤 요구 사항에 문제가 있습니까? – Vladimir