-2

I have a simple leader boards table for an iphone game that allows me to view the previous high scores however the background is black and therefore it is not visible. I am using the code:

[highscores addObject:[NSArray arrayWithObjects:@"Title",[NSNumber numberWithInt:5000],nil]];

Can I change the colour easily?

All help greatly appreciated, I expect it is simple but google is coming back with little.

Thanks in advanced!

user1432813
  • 162
  • 2
  • 10
  • 1
    How are you setting the color in the first place? – David Rönnqvist Jul 17 '12 at 12:00
  • You meant to say.. '[highscores addObject:@"whiteColor"];' '[view setBackgroundColor:[UIColor [highscores objectAtIndex:0]]];' ?? – Nina Jul 17 '12 at 12:00
  • No, I just want to keep the layout I have and add an extra method if needed to implement it in white. – user1432813 Jul 17 '12 at 12:02
  • @David, I have just used the default text colour, I have not edited it in any way to anything other than the default. – user1432813 Jul 17 '12 at 12:04
  • 4
    The code you put up doesn't affect the color at all. I don't understand what you mean. Can't you change the color in the XIB or storyboard? – woz Jul 17 '12 at 12:04
  • @Woz I have no xib or storyboard. – user1432813 Jul 17 '12 at 12:07
  • I don't understand what exactly you are trying!! You can simply change the background color when the particular method is called! – Nina Jul 17 '12 at 12:08
  • Did you try something like this: `[view setBackgroundColor:[UIColor whiteColor]];`? – woz Jul 17 '12 at 12:08
  • The background is and image that is constant throughout the app. – user1432813 Jul 17 '12 at 12:18
  • It's a `UIImage`? Then change it using: `[backgroundImage setImage:[UIImage imageNamed:@"foo"]];`. Is that what you mean? You need to edit your question to be more clear. – woz Jul 17 '12 at 12:21
  • Look, I am only 14 and I am new to programming, I appreciate the help everyone but I dont understand to well; the pastebin is here: http://pastebin.com/ZY5VRDNK I have established that it is tied to a UILabel so in a separate method I need to make the label text white/ – user1432813 Jul 17 '12 at 12:23
  • You want your label to have white text? If so, it's as simple as `[label setTextColor:[UIColor whiteColor]]` when you instantiate the `UILabel`. – Anshu Chimala Jul 17 '12 at 12:31

2 Answers2

2

changing the color is not related with an Array.Its related with the container who displays the Title . you may binding the Title string to any UILabel.

So you have to set the textColor property to white.

Eg: label1.textColor = [UIColor whiteColor];

Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102
1

To make the UILabel white, remove this code:

[label1 setRGB:0 :0 :0];

And add do this instead:

[label1 setTextColor:[UIColor whiteColor]];

Let me know if this helps you. Posting your code definitely helps. You are doing great at age 14, so keep it up.

woz
  • 10,888
  • 3
  • 34
  • 64