2013-03-07 3 views
0

, 파란색 retangle이 이미지처럼, 첫 번째 응답자가되는 NSTextField있는 객체 외부에 나타납니다 :
link for Normal CaseNSTextField 외부의 파란색 초점 링이 누락 되었습니까? 보통의 경우

는 그러나, 나는 밖에있는 파란색 테두리가없는 NSTextField있는 있어요. 왜 그런가요?

다음은 어떻게 작동하는지입니다.
> 일반적인 MAC OS 응용 프로그램을 만듭니다.
2> 해당보기의 addSubview : removeFromSuperview 메서드를 호출하여 앱의 하위보기를 전환합니다.
3> 하나의 서브 뷰 (실제로 위에서 언급 한 이미지 임)에서 "Next"버튼을 클릭합니다. 그 조치는 (하위 뷰의 컨트롤러하는 .m 파일에 정의)이 같은 것입니다 :

- (IBAction)actionNextClicked:(id)sender{ 
//_hdlThreadNext is a NSThread object 
    [[_hdlThreadNext alloc] initWithTarget:self [email protected](threadNext:) object:nil]; 
    [_hdlThreadNext start]; 
} 

을 그리고 스레드가 같은 수 있습니다 : 또 하나

- (void)threadNext:(id)sender{ 
    @autoreleasepool{ 
     BOOL success; 

     [CATransation begin]; 

     /* send username and password and decrypt responce */ 
     ... // balabala... and set "success" 

     if (success){ 
      [[self view] removeFromSuperview]; 
      [self sendMessageToSuperview:@"Add Next View"]; // Superview's method, telling superview to call addSubview: to add another subview 
     } 
     else{ 
      /* Nothing special to do */ 
     } 

     [CATransation commit]; 
    } 
} 

4> 하위 뷰 스위치. 그 콤보 뷰는 괜찮은 것 같습니다 : image for combo view
그러나 다른 NSTextView의 파란색 테두리는 더 이상 나타나지 않을 것입니다!

어떤 사람이 내가 잘못했는지 알고 있습니까? 고마워요!

답변

0

아마 내가 완전히 잘못된 프로그래밍을했기 때문에이 문제를 만난 사람은 거의 없었습니다.
이 문제를 해결할 방법을 찾았습니다. 그래픽 변경 사항은 블로그의 주 스레드에서 모두 수행해야한다고 언급했습니다. 따라서 다음과 같이 "if (success)"를 변경합니다.

if(success){ 
    dispatch_async(dispatch_get_main_queue()' ^{ 
     [[self view] removeFromSuperview]; 
     [self sendMessageToSuperview:@"Add Next View"]; 
    }); 
} 

해결되면 포커스 링이 다시 나타납니다.