내 프로젝트에서 다양한 변수가있는 문자열을 만든 다음 내 자막에 삽입합니다. 시뮬레이터에서 그 점이 나타납니다. 그러나 IPad에서는 변수가 하나 인 경우 NULL을 표시하고 다른 변수는 표시하지 않습니다. 아무도 비슷한 문제를 경험 한 적이 있습니까? 제가 이미지를 게시 할 수 없습니다 생각으로Xcode 시뮬레이션은 UITableView 자막의 값을 표시하지만 IPad는 <null>을 표시합니다.
(충분하지 않은 평판은 지금까지) 나는 단순히 그것을 아래로 입력하여 재구성 할 수 있습니다
IOS 시뮬레이터 :
을 .......... .................................................. ....
토마스 겨울
2014년 1월 5일 - 영속 : 0.5 시간
.................... ................. ...........................
실제 장치 :
............ .................................................. ..
토마스 겨울
2014년 1월 5일 - 영속 (널) 시간
...................... ..........................................
문자열은 beeing입니다. initString을 사용하여 함께 쓴다. WithFormat 메서드는 변수를 포함합니다. 자막에서 여전히 h가 어떻게 보이는지를 보았지만 그 전에는 Duration을 사용하지 않았기 때문에 변수가 실제 장치에서는 존재하지 않는다고 생각할 수 있습니다.
NSNumberFormatter * formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
[formatter setMaximumFractionDigits:2];
NSString * dauerString =[[NSString alloc]initWithFormat:@"Dauer: %@h",[formatter numberFromString:[[self.leistungListe objectAtIndex:indexPath.row]getDauer]]];
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"YYYY-MM-dd"];
NSString * dateString = [dateFormat stringFromDate:[[self.leistungListe objectAtIndex:indexPath.row]getDatum]];
NSString * detailTextString = [[NSString alloc]initWithFormat:@"%@ - %@",dateString,dauerString];
cell.detailTextLabel.text =detailTextString;
코드를 표시하면 도움이 될 수 있습니다. – SamB