제 신청서에 인쇄용 영수증 배열 을 만들고 싶습니다. 나는 문자열 사이에 적절한 정렬을 만들기 위해 고심하고있다.문자열 사이에 유연한 공백이 있습니까?
가 나는, 그래서
Coke 2 comment1
Chocolate 3 comment2
ice 4 comment3
은 현재 내가 여기에 그냥 고정 된 길이의 공간를 사용,이
NSMutableString* strBody = [NSMutableString string];
for (int i=0; i<[arrItems count];i++){
[strBody appendString:[NSString stringWithFormat:@"\n%@ %@ %@",[[arrItems objectAtIndex:i] objectForKey:@"ProductName"],[[arrItems objectAtIndex:i] objectForKey:@"ProductQuantity"],[[arrItems objectAtIndex:i] objectForKey:@"Comment"]]];
}
처럼 수행하지만 한 (적절한 정렬과) 같은 것을 만들려면 문제는 적절한 정렬을 얻지 못한다는 것입니다. 현재 내가 고민하고있는 것은 문자열 사이에 유연한 공간을 넣는 방법?
누군가 이와 같은 작업을 수행했다면 도움을주십시오. 당신은 별도의 UILabel
를 작성하고 모든 레이블을 정렬 할 setFrame
속성을 사용할 수 있습니다
[NSString을 오른쪽 패드에 [objective-c 코드?] 가능한 중복?] (http://stackoverflow.com/questions/5386351/objective-c-code-to-right-pad-a-nsstring) – Joe