Hi ,i have a contact form made with xib file it works but i can't change the background color of the view programmatically
i tryed with this but nothing, i know how to put an image background but i need to change the color on the fly
how can i do? thank you for help

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization

    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.view.backgroundColor = [UIColor redColor];


}

- (void)viewDidAppear:(BOOL)animated
{
    [self.view setBackgroundColor:[UIColor redColor]];

}

I would have thought that was enough. Have you tried putting that line in the if(self){} section of initWithNibName?

nothing it's always white with this code

@implementation zrkViewContattiIPHONE
@synthesize navBar;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.view.backgroundColor = [UIColor redColor];

    }
    return self;
}
// Add this method
- (BOOL)prefersStatusBarHidden {
    return YES;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.view.backgroundColor = [UIColor redColor];


}

- (void)viewDidAppear:(BOOL)animated
{
    //[self.view setBackgroundColor:[UIColor redColor]];
    self.view.backgroundColor = [UIColor redColor];

}

Hmmm, in your nib have you dragged another view over the entire window? It looks like there might be something on top the bottom layer which is white and that is blocking you from seing the parent view's color.
Just a thought...

yes you are right there was another view and a scrollview it was a mess i've deleted them and now it works thank you bye

This question has already been answered. Start a new discussion instead.