views:

179

answers:

0

Hi,

i have a problem. I use a Button as a BarButtonItem. It works fine so far, but my backgroundcolor works only if i click on my button. How can i set, that my backgroundcolor will be set every time ?

thx

     UIButton *redEmergencyButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];

 redEmergencyButton.frame = CGRectMake(100, 100, 100, 50);


 redEmergencyButton.backgroundColor = [UIColor colorWithRed:0.8 green:0.898039215686274509803
                blue:1.0 alpha:1.0];

 [redEmergencyButton setTitle:@"Emergency" forState:UIControlStateNormal];

 [redEmergencyButton addTarget:self action:@selector(doEmergency)
    forControlEvents:UIControlEventTouchUpInside];

 UIBarButtonItem *rButton = [[UIBarButtonItem alloc] 
          initWithCustomView:redEmergencyButton];