0

충돌 소스를 추적하려고합니다. 좀비를 찾기 위해 앱을 프로파일 링했는데 내 UILabels 중 하나에서 텍스트를 업데이트하는 것과 관련이있는 것으로 보입니다. 텍스트 값을 부적절하게 설정하고 있다고 생각하지 않습니다. 이 모양이 맞습니까? 나는 UILabels의 텍스트를 설정하고있어 어디왜 내 UILabel 할당이 해제됩니까?

enter image description here

이입니다. 지금 아래 암시로 UILabels에 대한 속성을 추가 한

하고하는 .m 파일을 합성 :

- (void) updateTimecodeDisplay 
{ 
    VarController *sharedController = [VarController sharedController]; 

    int time0 = sharedController.timeCode0Property; 
    int time1 = sharedController.timeCode1Property; 
    int time2 = sharedController.timeCode2Property; 
    int time3 = sharedController.timeCode3Property; 
    int time4 = sharedController.timeCode4Property; 
    int time5 = sharedController.timeCode5Property; 
    int time6 = sharedController.timeCode6Property; 
    int time7 = sharedController.timeCode7Property; 
    int time8 = sharedController.timeCode8Property; 
    int time9 = sharedController.timeCode9Property; 


    if (time0 != 16) 
    { 
     [timeCodeLabel0 setText:[NSString stringWithFormat:@"%d", time0]]; 
    } 
    else { 
     [timeCodeLabel0 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time1 != 16) 
    { 
     [timeCodeLabel1 setText:[NSString stringWithFormat:@"%d", time1]]; 
    } 
    else { 
     [timeCodeLabel1 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time2 != 16) 
    { 
     [timeCodeLabel2 setText:[NSString stringWithFormat:@"%d", time2]]; 
    } 
    else { 
     [timeCodeLabel2 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time3 != 16) 
    { 
     [timeCodeLabel3 setText:[NSString stringWithFormat:@"%d", time3]]; 
    } 
    else { 
     [timeCodeLabel3 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time4 != 16) 
    { 
     [timeCodeLabel4 setText:[NSString stringWithFormat:@"%d", time4]]; 
    } 
    else { 
     [timeCodeLabel4 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time5 != 16) 
    { 
     [timeCodeLabel5 setText:[NSString stringWithFormat:@"%d", time5]]; 
    } 
    else { 
     [timeCodeLabel5 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time6 != 16) 
    { 
     [timeCodeLabel6 setText:[NSString stringWithFormat:@"%d", time6]]; 
    } 
    else { 
     [timeCodeLabel6 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time7 != 16) 
    { 
     [timeCodeLabel7 setText:[NSString stringWithFormat:@"%d", time7]]; 
    } 
    else { 
     [timeCodeLabel7 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time8 != 16) 
    { 
     [timeCodeLabel8 setText:[NSString stringWithFormat:@"%d", time8]]; 
    } 
    else { 
     [timeCodeLabel8 setText:[NSString stringWithFormat:@""]]; 
    } 
    if (time9 != 16) 
    { 
     [timeCodeLabel9 setText:[NSString stringWithFormat:@"%d", time9]]; 
    } 
    else { 
     [timeCodeLabel9 setText:[NSString stringWithFormat:@""]]; 
    } 
} 

UILabels는 다음과 같이 헤더 파일에 선언되고있다. 그래도 여전히 똑같은 문제가 발생합니다. "->"

@property (weak) IBOutlet UILabel *timeCodeLabel0; 
@property (weak) IBOutlet UILabel *timeCodeLabel1; 
@property (weak) IBOutlet UILabel *timeCodeLabel2; 
@property (weak) IBOutlet UILabel *timeCodeLabel3; 
@property (weak) IBOutlet UILabel *timeCodeLabel4; 
@property (weak) IBOutlet UILabel *timeCodeLabel5; 
@property (weak) IBOutlet UILabel *timeCodeLabel6; 
@property (weak) IBOutlet UILabel *timeCodeLabel7; 
@property (weak) IBOutlet UILabel *timeCodeLabel8; 
@property (weak) IBOutlet UILabel *timeCodeLabel9; 
+0

를 사용 하는가? 보기가 화면에 표시되지 않을 때 updateTimecodeDisplay가 호출됩니까? – Bek

+0

UILabel을 뷰 컨트롤러의 속성이 아니라 전역으로 선언 했습니까? –

+0

감사합니다. – Luke

답변

1

난 당신이 얘기이 게시물을 확인해야한다고 생각 운영자 : Dot (".") operator and arrow ("->") operator use in C vs. Objective-C

그것은 당신이 사용 안된다는 것을 의미한다 "->"속성에 액세스 할 수 있습니다. 왜냐하면 많은 밑에있는 층이 있기 때문입니다. 희망이 도움이됩니다.

함께 IBOutlet은에 트리거되고있어 updateTimecodeDisplay에있는 라인 당신이 볼 수있는, 오른쪽에있는 스택 추적에서 @weak

+0

모든 UILabel을 신고하는 방법을 게시 할 수 있습니까? 더 많은 정보가 도움이 될 수 있습니다. –

+0

프로필에 의하면 좀비라고합니다. 문제가 게시 된 코드에없는이 문제를 일으킨 다른 곳이있을 수 있습니다. –

+0

IBOutlet은 약하게 사용해야합니다. 그렇지 않으면주기가 유지됩니다. –

관련 문제