2012-04-17 7 views
3

UIViewController가 있습니다. 이 컨트롤러에서 프로그래밍 방식으로 UITextView 만들고 내 컨트롤러로 해당 대리자를 설정하십시오. 내가 탭할 때 textView를 편집하기를 원하지 않기 때문에이 작업을 수행합니다.UITextView textViewShouldBeginEditing을 두 번 이상 두 번 누르면 충돌이 발생합니다.

UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(9, 10, 302, 200)]; 
[textView setDelegate:self]; 
[self.view addSubview:textView]; 
[textView release]; 

의 viewDidLoad 방법은 내가 textViewShouldBeginEditing 방법은 나타나지에서 키보드를 사용하지 NO 여기에 돌아 오지 구현했습니다.

textViewShouldBeginEditing 방법

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView 
{ 
    NSLog(@"Shouldbegin"); 
    return NO; 
} 

나는 그것이 한 번 작동하는 텍스트 뷰를 누릅니다 나타납니다,하지만 난 다시 눌러 경우 어떤 로그하지 않고 응용 프로그램을 충돌합니다 문제. 이상한 것은 textView를 잡고 릴리스 할 때 작동하도록 작동합니다. 다른 한 손에는 정상적인 단일 탭이 두 번째로 작동하지 않습니다.

편집

싱글 내가 x 초 정도 기다린 후 실 거예요 일 것 같다, 그래서 서로 또한, 작동하는 것 같다 후 신속하게 도청.

일부 테스트를 마친 후 iOS 5.X> 버그 인 것으로 나타났습니다. 4.3 장치/시뮬레이터에서 내 앱을 실행할 때 제대로 작동해야합니다.

Date/Time:  2012-04-17 14:00:49.497 +0200 
OS Version:  iPhone OS 5.1 (9B176) 
Report Version: 104 

Exception Type: EXC_BAD_ACCESS (SIGSEGV) 
Exception Codes: KERN_INVALID_ADDRESS at 0x00000014 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 TextInput      0x36bf69e8 TI::Favonius::BeamSearch::choose_hit_test_node(WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::KeyAreaNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&) + 12 
1 TextInput      0x36bf6d1e TI::Favonius::BeamSearch::update_for_touch(unsigned int, WTF::PassRefPtr<TI::Favonius::KeyAreaNode>) + 602 
2 TextInput      0x36bfb5c2 TI::Favonius::StrokeBuildManager::update_search_for_touch(unsigned int, int) + 66 
3 TextInput      0x36bfb97c TI::Favonius::StrokeBuildManager::key_down_or_drag_hit_test_for_UI(bool, CGPoint, double, int, int, float, bool, ZT::LayoutDictionaryContext&, bool, int) + 216 
4 TextInput      0x36bddf54 TIInputManagerZephyr::simulate_touches_for_input_string() + 344 
5 TextInput      0x36bed8ba -[TIKeyboardInputManagerZephyr candidates] + 214 
6 UIKit       0x31066616 -[UIKeyboardImpl generateAutocorrectionReplacements:] + 82 
7 UIKit       0x31108a96 __71-[UITextInteractionAssistant scheduleReplacementsForRange:withOptions:]_block_invoke_0 + 370 
8 UIKit       0x3110ec62 -[UITextSelectionView calculateAndShowReplacements:] + 6 
9 Foundation      0x3762192c __NSFireDelayedPerform + 408 
10 CoreFoundation     0x361a1a2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8 
11 CoreFoundation     0x361a1692 __CFRunLoopDoTimer + 358 
12 CoreFoundation     0x361a0268 __CFRunLoopRun + 1200 
13 CoreFoundation     0x3612349e CFRunLoopRunSpecific + 294 
14 CoreFoundation     0x36123366 CFRunLoopRunInMode + 98 
15 GraphicsServices    0x324e3432 GSEventRunModal + 130 
16 UIKit       0x30e70e76 UIApplicationMain + 1074 
+0

[textView release]; ViewDidLoad 메서드에서 가져온 다음 시도해보십시오. –

+0

작동하지 않습니다 :) – Wesley

+0

내 측면에서 잘 작동합니다.하지만 ARC 사용을 사용하고 있습니다. –

답변

0

일부 테스트 후 iOS 5.X> 버그 인 것으로 나타났습니다. 4.3 장치/시뮬레이터에서 내 앱을 실행할 때 제대로 작동해야합니다.

로그 파일을 편집 한 내 메인 포스트를보십시오.

+0

ARC를 사용하지 않는 경우 viewDidLoad 메서드 후에 해제되지 않도록 textView에 대한 속성 (nonatomic 유지)을 만들어야합니다 – calampunay

0

당신이 그것을 도청 때 UITextView의 편집을 시작하지 않으려면 : 할당 해제에

UITextView* textView = ...; 
textView.editable = NO; 
+0

나는 또한 알고 싶습니다 :) – Wesley

+0

UITapGestureRecognizer를 시도하십시오 –

0
-(BOOL)textViewShouldBeginEditing:(UITextView *)textView 
{ 

    [txtView resignFirstResponder]; 

} 

을 놓아 txtView 아이폰 OS 5.1 장치에서 오류 로그에 다음을 말한다 방법

1

해결책을 찾았습니다. 나는 정말로 애플 버그 주위에서 일하는 것을 좋아하지 않지만 가끔은해야한다. 이 세 단계 ...

1)) 눈에 보이지 않는보기

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    myTextView.inputView = customKeyboard; 
} 

2 기본 키보드를 교체 첫 번째 응답을 사임 textViewDidChangeSelection에서 편집

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{ 
    return YES; 
} 

3을) 할 수 있도록 YES 답변입니다 커서를 숨기려면

- (void)textViewDidChangeSelection:(UITextView *)textView{ 
    [textView resignFirstResponder]; 
} 
+0

OK 작업과 같이 :-). 나는 결국 그것을 고치기 위해 무엇을했는지 기억하지 못합니다. – Wesley

+0

키보드 유형이 숫자 패드 여야하고 나머지 단계가 작동하지 않기 때문에 키보드 유형을 변경할 수 없습니다. –

관련 문제