0
맞아요, 기본적으로 두 개의 숫자를 더하고 싶습니다. 그것은 근무 시간 계산기를위한 것이고 야간 근무 시나리오의 매개 변수를 if 문으로 포함했습니다. 그러나 이제는 하루 이동 패턴을 엉망으로 만듭니다. 그래서 시작 시간이 12보다 작 으면 if 문 대신 코드에 표시된 원래 방정식으로 되돌아갑니다.포인트와 정수의 비교
-(IBAction)done:(id)sender {
int result = [finishHours.text intValue] - [startHours.text intValue];
totalHours.text = [NSString stringWithFormat:@"%d", result];
if (result < 0) {
totalHours.text = [NSString stringWithFormat:@"%d", result * -1];
}
if (result < 12) {
totalHours.text = [NSString stringWithFormat:@"%d", result + 24];
}
if (startHours < 12) {
totalHours.text = [NSString stringWithFormat:@"%d", result - 24];
}
이 태그를 언어 (C#?)로 태그 할 수 있습니다. –
또한 예상되는 동작과 오류 메시지를 비롯한 어떤 동작을 정확하게 지정하십시오. – outis