Wednesday, July 9, 2014

How to change background color of view in iPhone app

Being able to change the background color of a view in an iphone app can be useful for many reasons. Whether you want to indicate an action or just match other images after an action is taken.

First, in your header file, create a method for your button click. Use the following code:
-(IBACTION)buttonClick:(sender);

Now, in the implementation file, add the following code:

-(IBACTION)buttonClick:(sender) {

[self.view.backgroundcolor colorBlue];


}

Where color blue is, you can add any color from the UIColor class.

Thanks for visiting and check out my car app for iPhone

No comments:

Post a Comment