이것은 스택 오버플로에 대한 첫 번째 질문입니다. 이 사이트를 잠시 사용 해왔고 프로그래밍 관련 질문에 대한 답변을 찾는 데 리소스를 사용했지만 이번에는 대답을 찾을 수 없습니다.NSMutable 문자열을 UILabel에 추가하는 방법
나는이 다섯 가지 문자열을 만들었습니다 그리고
//List five items from the book and turn them into strings
//1 Josh the Trucker
NSString *stringJosh = @"Josh the Trucker";
//2 The Witch from the Remote Town
NSString *stringWitch = @"The Witch from the Remote Town";
//3 Accepting the curse rules "Willingly and Knowingly"
NSString *stringRules = @"Accepting the curse rules, --Willingly and Knowingly--";
//4 Josh's time left to live--Five Days Alive Permitted
NSString *stringFiveDays = @"Josh's time left to live--Five Days Alive Permitted";
//5 The Fire Demon Elelmental
NSString *stringDemon = @"The Fire Demon Elelmental";
를, 내가 배열에 넣어했습니다
//Create an array of five items from the book
NSArray *itemsArray = [[NSArray alloc] initWithObjects:
stringJosh,
stringWitch,
stringRules,
stringFiveDays,
stringDemon,
nil];
을 그리고, 나는 통해 루프에 필요한이 변경 가능한 문자열을 생성 배열을 추가하고 항목을 UIlabel에 추가합니다.
NSMutableString *itemsString = [[NSMutableString alloc] initWithString:
@"itemsArray"];
다음은 콘솔 로그에 항목을 표시하는 루프입니다.
for (int i=0; i<5; i++)
{
NSLog(@"Book Item %d=%@", i, itemsArray[i]);
}
내 질문은 어떻게 이러한 항목을 UIlabel에 추가합니까? 이 함수는 내 appledelegate에 있습니다. 내 viewDidAppear 기능 (있는 FlipsideViewController)에서
나는이 :
label8.text =""----thats where the looped info needs to go.
내가 이걸 어떻게해야합니까? NSLog가 있어야하는 위치를 추가하고 추가해야한다고 생각합니다.하지만 그 정보를 텍스트 라벨로 어떻게 전송합니까?
나는 자신을 설명하기를 희망한다.
우리는하지 않은 예제를 추가,이 내가 "야생"
이것은 내가 몇 가지 방향을 찾을 수 바라고 있어요 내가 그렇게 알고 거칠 코딩 환경에서 답을 얻기 위해서 필요로하는 곳에 추측 이리.
감사합니다.
forloop 코드의 선 위에 당신이 연결할 필요가 의미합니까를 label.put하는 인덱스 텍스트를 배열 객체를 추가입니다 이 다섯 줄을 하나로 묶어서 UILabel에 넣으시겠습니까? –