일부 UILabels 및 버튼이 있습니다. 이것은 내 코드입니다.if 문을 사용하여 레이블 텍스트 변경 - obj c
if ([label.text isEqualToString:@"The three blue dots represents GPS towers. Click Go to advance"])
{
firstClick = [[UIAlertView alloc] initWithTitle:@"Welcome!"
message:@"Blah, blah blah"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[firstClick show];
distanceLabel.text = @"Distance to first tower: 50 km";
a = YES;
}
if (a)
{
label.text = @"Now you know that the distance to the first tower is 50 km. Click Go to advance";
}
이 모든 것은 버튼의 동작 방법에 있습니다. 버튼을 누르면 alertview보기가 표시되고 distanceLabel은 텍스트를 변경합니다. 그런 다음 경고의 OK 버튼을 클릭하여 label.text를 변경하고 싶습니다. 인스턴스 부울 시도했지만 그 doesnt 작동합니다. 왜 그 일을하지 않고 대신 무엇을해야합니까 ??
확인 /부리. 이 경우 –
, 중단 점, 단계 및 nil 확인 및 어쨌든 당신이 틀린 얻을합니다. – Ultrakorne
어떻게 nil을 확인합니까? –