How to append NSMutable strings into a UILabel
This is my first question to Stack Overflow. I have been using this site
for a while and have used it's resources to figure out answers to my
programming questions but I'm afraid I can't find the answer I'm looking
for this time.
I've created these five strings:
//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";
Then, I've put them in an array:
//Create an array of five items from the book
NSArray *itemsArray = [[NSArray alloc] initWithObjects:
stringJosh,
stringWitch,
stringRules,
stringFiveDays,
stringDemon,
nil];
Then, I created this mutable string where I need to loop through the array
and append the items to a UIlabel.
NSMutableString *itemsString = [[NSMutableString alloc] initWithString:
@"itemsArray"];
Here's the loop, which displays the items in the console log.
for (int i=0; i<5; i++)
{
NSLog(@"Book Item %d=%@", i, itemsArray[i]);
}
My question is, how do I append these items into the UIlabel? These
functions are in my appledelegate.
In my viewDidAppear function (flipsideViewController) I have:
label8.text =""----thats where the looped info needs to go.
How do I do this? I feel I need to put them together and append where the
NSLog should be...but how do I transfer that info to the textlabel?
I hope I explained myself.
We haven't done ANY append examples, I guess this is where I need to get
answers from the "wild"
This is the wildest coding environment I know so I'm hoping I can find
some direction here.
Thanks for taking a look!
No comments:
Post a Comment