그냥 서브 클래스 TTStyledTextLabel 다음과 같은 두 가지 방법을 오버라이드 (override) :
- (무효) touchesBegan : (NSSet *)는 withEvent 접촉 : (UIEvent를 *) 이벤트
- (무효)가 touchesEnded : (NSSet * (의 UIEvent *) 이벤트 바로이 같은
:)는 withEvent 접촉
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
UITouch* touch = [touches anyObject];
CGPoint point = [touch locationInView:self];
point.x -= _contentInset.left;
point.y -= _contentInset.top;
TTStyledBoxFrame* frame = [_text hitTest:point];
if (frame) {
[self setHighlightedFrame:frame];
}
}
- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
TTTableView* tableView = (TTTableView*)[self ancestorOrSelfWithClass:[TTTableView class]];
if (!tableView) {
if (_highlightedNode) {
// This is a dirty hack to decouple the UI from Style. TTOpenURL was originally within
// the node implementation. One potential fix would be to provide some protocol for these
// nodes to converse with.
if ([_highlightedNode isKindOfClass:[TTStyledLinkNode class]]) {
TTOpenURL([(TTStyledLinkNode*)_highlightedNode URL]);
} else if ([_highlightedNode isKindOfClass:[TTStyledButtonNode class]]) {
TTOpenURL([(TTStyledButtonNode*)_highlightedNode URL]);
} else {
[_highlightedNode performDefaultAction];
}
[self setHighlightedFrame:nil];
}
}
}
감사합니다. 몇 가지 변경 사항이 있었지만 링크를 통해 터치 만 차단할 수있었습니다. –