views:

36

answers:

2

Hi,

During a time in my app - I make a button a button not enabled

myButton.enabled = NO;

The problem is that I've made my button in IB with an image, and just a UILabel overtop of it. The label does not grey out when the buttons does.

In IB - is there a way to link the label to the button?

A: 

You can add another outlet in your code, i.e. IBOutlet UILabel *yourLabel;

Then link this outlet to your label, same procedure as linking the button.

Eiko
I see what you mean - But I do know if I've made myself understood.I want the label 'linked' with the button, so in the code when I call myButton.enabled = NO; The label AND the button both become greyed out.
Sam Jarman
+1  A: 

This is not possible without you doing the linking action yourself, as @Eiko rightly pointed out.

It sounds like you need to make your image the background-image of the button, so you can have your label as the button text, like it is intended to be used. Then you can specify colors, fonts & images for all 4 possible states.

If you decide to invent the wheel yourself, by keeping button and label as separate objects, you will have to invent everything around it as well.

mvds
I've made the image a backround image and used the title as the text.Much appreciated. Thank-you.
Sam Jarman