|Jan 31, 2013, 12:20 PM||#1|
changing color for a label
I am running Snow Leopard and running Xcode 4.0.
I am trying to change the color of text in a label, however I can't seem to get it to work.
I read the developer documentation, and when I use the line:
[myText setTextColor:<#(NSColor *)#>
Can someone tell me what I am supposed to do? I know that NSColor is looking for a pointer, but nothing I try seems to work.
Simple for others, perhaps, but I am just starting here.
UPDATE: I am getting closer. This doesn't work, but seems to be on track, if that seems right
[myText setTextColor:(NSColor *) redColor];
Last edited by azrael2000; Jan 31, 2013 at 01:11 PM.
|Jan 31, 2013, 01:41 PM||#2|
You're very close! The key is that redColor is a class method of NSColor (that returns an object of type NSColor *), so you need to call it like this: [NSColor redColor]
See if you can figure out the correct statement now.
|Jan 31, 2013, 01:43 PM||#3|
Since you're just starting, what tutorial or book are you learning from? Be specific. Exact URL, or title, author, and edition number.
Syntax is fundamental. If you don't know the correct syntax, you need to learn it. After you learn it, you should be able to answer the NSColor question yourself. Conversely, if you don't know correct syntax, then having the answer for NSColor won't help you in any other situation.
So the best solution is to go back to the fundamentals, learn the correct syntax, then apply that to the NSColor situation.
|Jan 31, 2013, 02:56 PM||#4|
I haven't found any good books or tutorials. I have been teaching myself, though I do have some grounding in building console applications.
I have been going through the documentation that goes through Xcode, and did my best reading it with what limited knowledge I have. If I had a better idea of what I was looking for IN the documentation, that would help! <smile>
|Jan 31, 2013, 04:12 PM||#5|
If already know C, or something similar to it, try Learning Objective-C :A Primer.
Also see the link here:
Find more with this google search terms:
There's also a Getting Started section on the main Apple Developer navigation page.
Xcode's documentation is reference documentation, not a tutorial.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Changing color in the new iWork||Ahmahzahn||Mac Applications and Mac App Store||0||Apr 11, 2014 12:26 AM|
|Color label files depending on iTunes rating?||TheGenerous||Digital Audio||2||May 26, 2013 09:54 PM|
|xCode label text color change||kushalashok||Web Design and Development||1||Feb 15, 2013 05:22 AM|
|Label color of Windows Partition Icon||tv3636||OS X||0||Jul 1, 2012 05:25 AM|
|Changing bg color with FolderEnhancer||ddublu||Jailbreaks and iOS Hacks||0||Jun 6, 2012 05:04 PM|
All times are GMT -5. The time now is 11:35 PM.