Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 16, 2013, 06:46 PM   #1
Dreamspinner
macrumors member
 
Join Date: Dec 2012
Debugging color problem(s)

OS X 10.8.2, XCode 4.5.2.

I put a round button on my view and set it borderless and used it to simulate an LED. I set the color thus. Worked well.
Code:
[[buttonLED3 cell] setBackgroundColor:[NSColor redColor]];
[[buttonLED3 cell] setBackgroundColor:[NSColor greenColor]];
Then I colored the background like this:
Code:
NSColor *myColor = [NSColor colorWithCalibratedRed:(189/255.0f) green:(219/255.0f) blue:(201/255.0f) alpha:(1.0)];
[myColor set];
[myWindow setBackgroundColor:myColor];
Next I colored the other buttons using core animation/content filters.

Somewhere along the way the LEDS quit, they show no color.

I went back and removed all the window coloring and the core animation settings and did a clean. I even added another simulated LED, but still no color.

Two questions. How can I debug the loss of ability to color the LEDS?

Is there a conflict between any of the steps I took that would prevent me from doing all the coloring?
Dreamspinner is offline   0 Reply With Quote
Old Jan 16, 2013, 07:07 PM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
The line

Code:
[myColor set];
Seems out of place. Maybe try removing it and see what happens?
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Jan 17, 2013, 12:51 AM   #3
ytk
macrumors regular
 
Join Date: Jul 2010
This is a long shot, but sometimes it seems like UI elements don't always realize they need display updating correctly (or rather, when you might think they should). You might try calling setNeedsDisplay:YES on anything that doesn't look like you expect it to. If that doesn't work, try just issuing a straight-up display to the object (e.g., [[buttonLED3 cell] display]).
ytk is offline   0 Reply With Quote
Old Jan 17, 2013, 06:29 AM   #4
Dreamspinner
Thread Starter
macrumors member
 
Join Date: Dec 2012
Quote:
Originally Posted by ArtOfWarfare View Post
The line

Code:
[myColor set];
Seems out of place. Maybe try removing it and see what happens?
That's part of coloring the background, not the LED. Removing it had no effect on either.

----------

Quote:
Originally Posted by ytk View Post
This is a long shot, but sometimes it seems like UI elements don't always realize they need display updating correctly (or rather, when you might think they should). You might try calling setNeedsDisplay:YES on anything that doesn't look like you expect it to. If that doesn't work, try just issuing a straight-up display to the object (e.g., [[buttonLED3 cell] display]).
Good thought, but no joy. I can sorta understand the one that was there getting unhooked by the other changes, but not the newly added one.
Dreamspinner is offline   0 Reply With Quote
Old Jan 17, 2013, 06:47 AM   #5
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Are your outlets set properly?

It seems like you might want to just zip your project and post it to these forums so someone else can take a look at it... I don't think we can help you with just the snippets and description you've given so far...
ArtOfWarfare is offline   0 Reply With Quote
Old Jan 17, 2013, 07:17 AM   #6
Dreamspinner
Thread Starter
macrumors member
 
Join Date: Dec 2012
Quote:
Originally Posted by ArtOfWarfare View Post
Are your outlets set properly?

It seems like you might want to just zip your project and post it to these forums so someone else can take a look at it... I don't think we can help you with just the snippets and description you've given so far...
Good thought. I had already reset the outlet for the first one, and set the outlet for the new one. Now I tried adding a level indicator and changing the level on that, and ..... HUH?.... the 2nd LED button started working.
Removed the progress bar and the button still works. I also removed the 1st button. All this before I read this post, so I don''t think attaching the project would be of any benefit, but I will if you think it would.

So, problem gone. Not understood, just gone.
Dreamspinner is offline   0 Reply With Quote
Old Jan 17, 2013, 01:24 PM   #7
ytk
macrumors regular
 
Join Date: Jul 2010
Well, sometimes your outlets get stopped up with extra bits and junk, and you need to clear that out for them to work properly. The solution is to create an NSOutletPlunger and call [plunger unclogOutletsForObject:].
ytk is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Strange Color Inversion Problem dbalone45 OS X Mavericks (10.9) 2 Feb 3, 2014 07:20 PM
Calendar color problem humar OS X Mavericks (10.9) 8 Oct 17, 2013 03:15 AM
Mavericks color problem circassian777 OS X Mavericks (10.9) 15 Oct 6, 2013 04:31 PM
Dual thunderbolt displays color problem air23cary Mac Peripherals 1 Jan 22, 2013 05:23 PM
Color Calibration Problem Thethuthinang Mac Programming 0 Jun 30, 2012 09:36 PM

Forum Jump

All times are GMT -5. The time now is 03:04 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC